Skip to content

Commit 3759b57

Browse files
committed
Fixed typo... And a billion other things.
1 parent dd74807 commit 3759b57

File tree

10 files changed

+34
-23
lines changed

10 files changed

+34
-23
lines changed

doc/rust.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ An example of `use` declarations:
802802

803803
~~~~
804804
use core::float::sin;
805-
use core::str::{slice, to_upper};
805+
use core::str::{slice, contains};
806806
use core::option::Some;
807807
808808
fn main() {
@@ -813,8 +813,8 @@ fn main() {
813813
info!(Some(1.0));
814814
815815
// Equivalent to
816-
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
817-
info!(to_upper(slice("foo", 0, 1)));
816+
// 'info!(core::str::contains(core::str::slice("foo", 0, 1), "oo"));'
817+
info!(contains(slice("foo", 0, 1), "oo"));
818818
}
819819
~~~~
820820

src/compiletest/errors.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
5151
let start_kind = idx;
5252
while idx < len && line[idx] != (' ' as u8) { idx += 1u; }
5353

54-
// FIXME: 4318 Instead of to_str_ascii, could use
55-
// to_str_consume to not do a unneccessary copy.
56-
let kind = str::slice(line, start_kind, idx).to_ascii().to_lower().to_str_ascii();
54+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
55+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
56+
let kind = str::slice(line, start_kind, idx);
57+
let kind = kind.to_ascii().to_lower().to_str_ascii();
5758

5859
// Extract msg:
5960
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }

src/libcore/path.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use libc;
1919
use option::{None, Option, Some};
2020
use str;
2121
use to_str::ToStr;
22+
use ascii::{AsciiCast, AsciiStr};
2223

2324
#[deriving(Clone, Eq)]
2425
pub struct WindowsPath {
@@ -753,8 +754,8 @@ impl GenericPath for WindowsPath {
753754
fn is_restricted(&self) -> bool {
754755
match self.filestem() {
755756
Some(stem) => {
756-
// FIXME: 4318 Instead of to_str_ascii, could use
757-
// to_str_consume to not do a unneccessary copy.
757+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
758+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
758759
match stem.to_ascii().to_lower().to_str_ascii() {
759760
~"con" | ~"aux" | ~"com1" | ~"com2" | ~"com3" | ~"com4" |
760761
~"lpt1" | ~"lpt2" | ~"lpt3" | ~"prn" | ~"nul" => true,
@@ -812,8 +813,8 @@ impl GenericPath for WindowsPath {
812813
device: match self.device {
813814
None => None,
814815

815-
// FIXME: 4318 Instead of to_str_ascii, could use
816-
// to_str_consume to not do a unneccessary copy.
816+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
817+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
817818
Some(ref device) => Some(device.to_ascii().to_upper().to_str_ascii())
818819
},
819820
is_absolute: self.is_absolute,

src/libcore/str.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use option::{None, Option, Some};
2727
use iterator::Iterator;
2828
use ptr;
2929
use str;
30-
use u8;
3130
use uint;
3231
use vec;
3332
use to_str::ToStr;

src/libcore/str/ascii.rs

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ impl ToStrConsume for ~[Ascii] {
199199
#[cfg(test)]
200200
mod tests {
201201
use super::*;
202+
use str;
202203

203204
macro_rules! v2ascii (
204205
( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]);

src/libcore/unstable/extfmt.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,12 @@ pub mod rt {
521521
TyDefault => uint_to_str_prec(u, 10, prec),
522522
TyHexLower => uint_to_str_prec(u, 16, prec),
523523
524-
// FIXME: 4318 Instead of to_str_ascii, could use
525-
// to_str_consume to not do a unneccessary copy.
526-
TyHexUpper => uint_to_str_prec(u, 16, prec).to_ascii().to_upper().to_str_ascii(),
524+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
525+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
526+
TyHexUpper => {
527+
let s = uint_to_str_prec(u, 16, prec);
528+
s.to_ascii().to_upper().to_str_ascii()
529+
}
527530
TyBits => uint_to_str_prec(u, 2, prec),
528531
TyOctal => uint_to_str_prec(u, 8, prec)
529532
};

src/librustc/driver/driver.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,10 @@ pub fn build_session_options(binary: @~str,
547547
for lint_levels.each |level| {
548548
let level_name = lint::level_to_str(*level);
549549
550-
// FIXME: 4318 Instead of to_str_ascii, could use
551-
// to_str_consume to not do a unneccessary copy.
552-
let level_short = level_name.substr(0,1).to_ascii().to_upper().to_str_ascii();
550+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
551+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
552+
let level_short = level_name.substr(0,1);
553+
let level_short = level_short.to_ascii().to_upper().to_str_ascii();
553554
let flags = vec::append(getopts::opt_strs(matches, level_short),
554555
getopts::opt_strs(matches, level_name));
555556
for flags.each |lint_name| {

src/librustdoc/markdown_index_pass.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ pub fn pandoc_header_id(header: &str) -> ~str {
157157
let s = str::replace(s, ~" ", ~"-");
158158
return s;
159159
}
160-
// FIXME: 4318 Instead of to_str_ascii, could use
161-
// to_str_consume to not do a unneccessary copy.
160+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
161+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
162162
fn convert_to_lowercase(s: &str) -> ~str { s.to_ascii().to_lower().to_str_ascii() }
163163
fn remove_up_to_first_letter(s: &str) -> ~str { s.to_str() }
164164
fn maybe_use_section_id(s: &str) -> ~str { s.to_str() }

src/libstd/sort.rs

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

src/test/bench/shootout-k-nucleotide-pipes.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
5959
for pairs_sorted.each |kv| {
6060
let (k,v) = copy *kv;
6161
unsafe {
62-
buffer += (fmt!("%s %0.3f\n", str::to_upper(str::raw::from_bytes(k)), v));
62+
let b = str::raw::from_bytes(k);
63+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
64+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
65+
buffer += (fmt!("%s %0.3f\n", b.to_ascii().to_upper().to_str_ascii(), v));
6366
}
6467
}
6568

@@ -68,7 +71,9 @@ fn sort_and_fmt(mm: &HashMap<~[u8], uint>, total: uint) -> ~str {
6871

6972
// given a map, search for the frequency of a pattern
7073
fn find(mm: &HashMap<~[u8], uint>, key: ~str) -> uint {
71-
match mm.find(&str::to_bytes(str::to_lower(key))) {
74+
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
75+
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
76+
match mm.find(&str::to_bytes(key.to_ascii().to_lower().to_str_ascii())) {
7277
option::None => { return 0u; }
7378
option::Some(&num) => { return num; }
7479
}

0 commit comments

Comments
 (0)