Fixed typo... And a billion other things.

This commit is contained in:
Marvin Löbel 2013-04-23 18:20:55 +02:00
parent dd74807957
commit 3759b5711d
10 changed files with 34 additions and 23 deletions

View File

@ -802,7 +802,7 @@ An example of `use` declarations:
~~~~
use core::float::sin;
use core::str::{slice, to_upper};
use core::str::{slice, contains};
use core::option::Some;
fn main() {
@ -813,8 +813,8 @@ fn main() {
info!(Some(1.0));
// Equivalent to
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
info!(to_upper(slice("foo", 0, 1)));
// 'info!(core::str::contains(core::str::slice("foo", 0, 1), "oo"));'
info!(contains(slice("foo", 0, 1), "oo"));
}
~~~~

View File

@ -51,9 +51,10 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
let start_kind = idx;
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
let kind = str::slice(line, start_kind, idx).to_ascii().to_lower().to_str_ascii();
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
let kind = str::slice(line, start_kind, idx);
let kind = kind.to_ascii().to_lower().to_str_ascii();
// Extract msg:
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }

View File

@ -19,6 +19,7 @@ use libc;
use option::{None, Option, Some};
use str;
use to_str::ToStr;
use ascii::{AsciiCast, AsciiStr};
#[deriving(Clone, Eq)]
pub struct WindowsPath {
@ -753,8 +754,8 @@ impl GenericPath for WindowsPath {
fn is_restricted(&self) -> bool {
match self.filestem() {
Some(stem) => {
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
match stem.to_ascii().to_lower().to_str_ascii() {
~"con" | ~"aux" | ~"com1" | ~"com2" | ~"com3" | ~"com4" |
~"lpt1" | ~"lpt2" | ~"lpt3" | ~"prn" | ~"nul" => true,
@ -812,8 +813,8 @@ impl GenericPath for WindowsPath {
device: match self.device {
None => None,
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
Some(ref device) => Some(device.to_ascii().to_upper().to_str_ascii())
},
is_absolute: self.is_absolute,

View File

@ -27,7 +27,6 @@ use option::{None, Option, Some};
use iterator::Iterator;
use ptr;
use str;
use u8;
use uint;
use vec;
use to_str::ToStr;

View File

@ -199,6 +199,7 @@ impl ToStrConsume for ~[Ascii] {
#[cfg(test)]
mod tests {
use super::*;
use str;
macro_rules! v2ascii (
( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]);

View File

@ -521,9 +521,12 @@ pub mod rt {
TyDefault => uint_to_str_prec(u, 10, prec),
TyHexLower => uint_to_str_prec(u, 16, prec),
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
TyHexUpper => uint_to_str_prec(u, 16, prec).to_ascii().to_upper().to_str_ascii(),
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
TyHexUpper => {
let s = uint_to_str_prec(u, 16, prec);
s.to_ascii().to_upper().to_str_ascii()
}
TyBits => uint_to_str_prec(u, 2, prec),
TyOctal => uint_to_str_prec(u, 8, prec)
};

View File

@ -547,9 +547,10 @@ pub fn build_session_options(binary: @~str,
for lint_levels.each |level| {
let level_name = lint::level_to_str(*level);
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
let level_short = level_name.substr(0,1).to_ascii().to_upper().to_str_ascii();
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
let level_short = level_name.substr(0,1);
let level_short = level_short.to_ascii().to_upper().to_str_ascii();
let flags = vec::append(getopts::opt_strs(matches, level_short),
getopts::opt_strs(matches, level_name));
for flags.each |lint_name| {

View File

@ -157,8 +157,8 @@ pub fn pandoc_header_id(header: &str) -> ~str {
let s = str::replace(s, ~" ", ~"-");
return s;
}
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
fn convert_to_lowercase(s: &str) -> ~str { s.to_ascii().to_lower().to_str_ascii() }
fn remove_up_to_first_letter(s: &str) -> ~str { s.to_str() }
fn maybe_use_section_id(s: &str) -> ~str { s.to_str() }

View File

@ -885,8 +885,8 @@ mod tests {
// tjc: funny that we have to use parens
fn ile(x: &(&'static str), y: &(&'static str)) -> bool
{
// FIXME: 4318 Instead of to_str_ascii, could use
// to_str_consume to not do a unneccessary copy.
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
// (Actually, could just remove the to_str_* call, but needs an deriving(Ord) on
// Ascii)
let x = x.to_ascii().to_lower().to_str_ascii();

View File

@ -59,7 +59,10 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
for pairs_sorted.each |kv| {
let (k,v) = copy *kv;
unsafe {
buffer += (fmt!("%s %0.3f\n", str::to_upper(str::raw::from_bytes(k)), v));
let b = str::raw::from_bytes(k);
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
buffer += (fmt!("%s %0.3f\n", b.to_ascii().to_upper().to_str_ascii(), v));
}
}
@ -68,7 +71,9 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
// given a map, search for the frequency of a pattern
fn find(mm: &HashMap<~[u8], uint>, key: ~str) -> uint {
match mm.find(&str::to_bytes(str::to_lower(key))) {
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
match mm.find(&str::to_bytes(key.to_ascii().to_lower().to_str_ascii())) {
option::None => { return 0u; }
option::Some(&num) => { return num; }
}