remove leftover obsolete string literals

This commit is contained in:
Daniel Micay 2014-05-01 01:32:13 -04:00
parent 4baff4e15f
commit 7852625b86
21 changed files with 70 additions and 70 deletions

View File

@ -170,7 +170,7 @@ fn parse_compile_flags(line: &str) -> Option<~str> {
}
fn parse_run_flags(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"run-flags")
parse_name_value_directive(line, "run-flags".to_owned())
}
fn parse_debugger_cmd(line: &str) -> Option<~str> {

View File

@ -698,13 +698,13 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
///
/// // check for a specific one.
/// if !book_reviews.contains_key(& &"Les Misérables") {
/// if !book_reviews.contains_key(&("Les Misérables")) {
/// println!("We've got {} reviews, but Les Misérables ain't one.",
/// book_reviews.len());
/// }
///
/// // oops, this review has a lot of spelling mistakes, let's delete it.
/// book_reviews.remove(& &"The Adventures of Sherlock Holmes");
/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
///
/// // look up the values associated with some keys.
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];

View File

@ -1651,10 +1651,10 @@ mod test_set {
// FIXME: #5801: this needs a type hint to compile...
let result: Option<(&uint, & &'static str)> = z.next();
assert_eq!(result.unwrap(), (&5u, & &"bar"));
assert_eq!(result.unwrap(), (&5u, &("bar")));
let result: Option<(&uint, & &'static str)> = z.next();
assert_eq!(result.unwrap(), (&11u, & &"foo"));
assert_eq!(result.unwrap(), (&11u, &("foo")));
let result: Option<(&uint, & &'static str)> = z.next();
assert!(result.is_none());

View File

@ -1441,7 +1441,7 @@ mod tests {
optmulti("l", "", "Desc", "VAL"));
let expected =
~"Usage: fruits
"Usage: fruits
Options:
-b --banana VAL Desc
@ -1450,7 +1450,7 @@ Options:
-k --kiwi Desc
-p [VAL] Desc
-l VAL Desc
";
".to_owned();
let generated_usage = usage("Usage: fruits", optgroups.as_slice());
@ -1471,13 +1471,13 @@ Options:
"This is a long description which _will_ be wrapped..+.."));
let expected =
~"Usage: fruits
"Usage: fruits
Options:
-k --kiwi This is a long description which won't be wrapped..+..
-a --apple This is a long description which _will_ be
wrapped..+..
";
".to_owned();
let usage = usage("Usage: fruits", optgroups.as_slice());
@ -1496,14 +1496,14 @@ Options:
confuse the line wrapping; an apple costs 0.51 in some parts of Europe."));
let expected =
~"Usage: fruits
"Usage: fruits
Options:
-k --kw The word kiwi is normally spelled with two i's
-a --apple This description has some characters that could
confuse the line wrapping; an apple costs 0.51 in
some parts of Europe.
";
".to_owned();
let usage = usage("Usage: fruits", optgroups.as_slice());

View File

@ -116,7 +116,7 @@ impl<'a> NfaGen<'a> {
|cx, name| match name {
&Some(ref name) => {
let name = name.as_slice();
quote_expr!(cx, Some(~$name))
quote_expr!(cx, Some($name.to_owned()))
}
&None => quote_expr!(cx, None),
}
@ -306,7 +306,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
}
::regex::Regex {
original: ~$regex,
original: $regex.to_owned(),
names: vec!$cap_names,
p: ::regex::native::Native(exec),
}

View File

@ -2629,16 +2629,16 @@ mod tests {
assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2)));
assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5)));
assert_eq!(from_str("\"\""), Ok(String(~"")));
assert_eq!(from_str("\"foo\""), Ok(String(~"foo")));
assert_eq!(from_str("\"\\\"\""), Ok(String(~"\"")));
assert_eq!(from_str("\"\\b\""), Ok(String(~"\x08")));
assert_eq!(from_str("\"\\n\""), Ok(String(~"\n")));
assert_eq!(from_str("\"\\r\""), Ok(String(~"\r")));
assert_eq!(from_str("\"\\t\""), Ok(String(~"\t")));
assert_eq!(from_str(" \"foo\" "), Ok(String(~"foo")));
assert_eq!(from_str("\"\\u12ab\""), Ok(String(~"\u12ab")));
assert_eq!(from_str("\"\\uAB12\""), Ok(String(~"\uAB12")));
assert_eq!(from_str("\"\""), Ok(String("".to_owned())));
assert_eq!(from_str("\"foo\""), Ok(String("foo".to_owned())));
assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_owned())));
assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_owned())));
assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_owned())));
assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_owned())));
assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_owned())));
assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_owned())));
assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u12ab".to_owned())));
assert_eq!(from_str("\"\\uAB12\""), Ok(String("\uAB12".to_owned())));
}
#[test]
@ -2902,7 +2902,7 @@ mod tests {
fn test_find(){
let json_value = from_str("{\"dog\" : \"cat\"}").unwrap();
let found_str = json_value.find(&"dog".to_owned());
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == &"cat");
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cat");
}
#[test]
@ -2910,7 +2910,7 @@ mod tests {
let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap();
let found_str = json_value.find_path(&[&"dog".to_owned(),
&"cat".to_owned(), &"mouse".to_owned()]);
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == &"cheese");
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cheese");
}
#[test]
@ -2918,7 +2918,7 @@ mod tests {
let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap();
let found_str = json_value.search(&"mouse".to_owned()).and_then(|j| j.as_string());
assert!(found_str.is_some());
assert!(found_str.unwrap() == &"cheese");
assert!(found_str.unwrap() == "cheese");
}
#[test]
@ -2958,7 +2958,7 @@ mod tests {
fn test_as_string(){
let json_value = from_str("\"dog\"").unwrap();
let json_str = json_value.as_string();
let expected_str = &"dog";
let expected_str = "dog";
assert_eq!(json_str, Some(expected_str));
}
@ -3079,7 +3079,7 @@ mod tests {
r#"{ "foo":"bar", "array" : [0, 1, 2,3 ,4,5], "idents":[null,true,false]}"#,
~[
(ObjectStart, ~[]),
(StringValue(~"bar"), ~[Key("foo")]),
(StringValue("bar".to_owned()), ~[Key("foo")]),
(ListStart, ~[Key("array")]),
(NumberValue(0.0), ~[Key("array"), Index(0)]),
(NumberValue(1.0), ~[Key("array"), Index(1)]),
@ -3167,7 +3167,7 @@ mod tests {
(NumberValue(1.0), ~[Key("a")]),
(ListStart, ~[Key("b")]),
(BooleanValue(true), ~[Key("b"), Index(0)]),
(StringValue(~"foo\nbar"), ~[Key("b"), Index(1)]),
(StringValue("foo\nbar".to_owned()), ~[Key("b"), Index(1)]),
(ObjectStart, ~[Key("b"), Index(2)]),
(ObjectStart, ~[Key("b"), Index(2), Key("c")]),
(NullValue, ~[Key("b"), Index(2), Key("c"), Key("d")]),
@ -3299,7 +3299,7 @@ mod tests {
assert!(stack.last_is_index());
assert!(stack.get(0) == Index(1));
stack.push_key(~"foo");
stack.push_key("foo".to_owned());
assert!(stack.len() == 2);
assert!(stack.is_equal_to([Index(1), Key("foo")]));
@ -3311,7 +3311,7 @@ mod tests {
assert!(stack.get(0) == Index(1));
assert!(stack.get(1) == Key("foo"));
stack.push_key(~"bar");
stack.push_key("bar".to_owned());
assert!(stack.len() == 3);
assert!(stack.is_equal_to([Index(1), Key("foo"), Key("bar")]));
@ -3375,7 +3375,7 @@ mod tests {
}
fn big_json() -> ~str {
let mut src = ~"[\n";
let mut src = "[\n".to_owned();
for _ in range(0, 500) {
src = src + r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": [1,2,3]},"#;
}

View File

@ -62,7 +62,7 @@
//! let mut flags = FlagA | FlagB;
//! flags.clear();
//! assert!(flags.is_empty());
//! assert_eq!(format!("{}", flags), ~"hi!");
//! assert_eq!(format!("{}", flags).as_slice(), "hi!");
//! }
//! ~~~
//!

View File

@ -343,7 +343,7 @@ mod tests {
assert_eq!(hasher.hash(&'a'), 97);
assert_eq!(hasher.hash(& &"a"), 97 + 0xFF);
assert_eq!(hasher.hash(&("a")), 97 + 0xFF);
assert_eq!(hasher.hash(& &[1u8, 2u8, 3u8]), 9);
unsafe {

View File

@ -560,7 +560,7 @@ mod tests {
($path:expr, $disp:ident, $exp:expr) => (
{
let path = Path::new($path);
assert!(path.$disp().to_str() == ~$exp);
assert!(path.$disp().to_str().as_slice() == $exp);
}
)
)

View File

@ -637,7 +637,7 @@ fn test_repr() {
exact_test(&true, "true");
exact_test(&false, "false");
exact_test(&1.234, "1.234f64");
exact_test(&(&"hello"), "\"hello\"");
exact_test(&("hello"), "\"hello\"");
// FIXME What do I do about this one?
exact_test(&("he\u10f3llo".to_owned()), "~\"he\\u10f3llo\"");

View File

@ -2031,12 +2031,12 @@ pub trait StrSlice<'a> {
/// # Example
///
/// ```rust
/// let s = ~"Do you know the muffin man,
/// The muffin man, the muffin man, ...";
/// let s = "Do you know the muffin man,
/// The muffin man, the muffin man, ...".to_owned();
///
/// assert_eq!(s.replace("muffin man", "little lamb"),
/// ~"Do you know the little lamb,
/// The little lamb, the little lamb, ...");
/// "Do you know the little lamb,
/// The little lamb, the little lamb, ...".to_owned());
///
/// // not found, so no change.
/// assert_eq!(s.replace("cookie monster", "little lamb"), s);
@ -3606,11 +3606,11 @@ mod tests {
#[test]
fn test_total_ord() {
"1234".cmp(& &"123") == Greater;
"123".cmp(& &"1234") == Less;
"1234".cmp(& &"1234") == Equal;
"12345555".cmp(& &"123456") == Less;
"22".cmp(& &"1234") == Greater;
"1234".cmp(&("123")) == Greater;
"123".cmp(&("1234")) == Less;
"1234".cmp(&("1234")) == Equal;
"12345555".cmp(&("123456")) == Less;
"22".cmp(&("1234")) == Greater;
}
#[test]
@ -4007,7 +4007,7 @@ mod tests {
#[test]
fn test_from_str() {
let owned: Option<~str> = from_str(&"string");
let owned: Option<~str> = from_str("string");
assert_eq!(owned, Some("string".to_owned()));
}

View File

@ -242,7 +242,7 @@ impl<T: Clone> Vec<T> {
///
/// ```rust
/// let mut vec = vec!("hello");
/// vec.grow(2, & &"world");
/// vec.grow(2, &("world"));
/// assert_eq!(vec, vec!("hello", "world", "world"));
/// ```
pub fn grow(&mut self, n: uint, value: &T) {
@ -267,8 +267,8 @@ impl<T: Clone> Vec<T> {
///
/// ```rust
/// let mut vec = vec!("a", "b", "c");
/// vec.grow_set(1, & &"fill", "d");
/// vec.grow_set(4, & &"fill", "e");
/// vec.grow_set(1, &("fill"), "d");
/// vec.grow_set(4, &("fill"), "e");
/// assert_eq!(vec, vec!("a", "d", "c", "fill", "e"));
/// ```
pub fn grow_set(&mut self, index: uint, initval: &T, value: T) {

View File

@ -185,7 +185,7 @@ fn encode_inner(s: &str, full_url: bool) -> ~str {
* ```rust
* use url::encode;
*
* let url = encode(&"https://example.com/Rust (programming language)");
* let url = encode("https://example.com/Rust (programming language)");
* println!("{}", url); // https://example.com/Rust%20(programming%20language)
* ```
*/
@ -260,7 +260,7 @@ fn decode_inner(s: &str, full_url: bool) -> ~str {
* ```rust
* use url::decode;
*
* let url = decode(&"https://example.com/Rust%20(programming%20language)");
* let url = decode("https://example.com/Rust%20(programming%20language)");
* println!("{}", url); // https://example.com/Rust (programming language)
* ```
*/

View File

@ -30,7 +30,7 @@ impl Drop for S {
}
fn move_in_match() {
match S {f:~"foo", g:~"bar"} {
match S {f: "foo".to_owned(), g: "bar".to_owned()} {
S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait
f: _s, //~ NOTE attempting to move value to here
g: _t //~ NOTE and here

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
static a: &'static str = &"foo";
static a: &'static str = "foo";
static b: *u8 = a as *u8; //~ ERROR non-scalar cast
static c: *u8 = &a as *u8; //~ ERROR mismatched types

View File

@ -33,7 +33,7 @@ pub fn main() {
(&[1]).test_imm();
("test").test_imm();
("test".to_owned()).test_imm();
(&"test").test_imm();
("test").test_imm();
// FIXME: Other types of mutable vecs don't currently exist

View File

@ -10,9 +10,9 @@
pub fn main() {
let x = &"hello";
let v = &"hello";
let y : &str = &"there";
let x = "hello";
let v = "hello";
let y : &str = "there";
println!("{}", x);
println!("{}", y);
@ -20,15 +20,15 @@ pub fn main() {
assert_eq!(x[0], 'h' as u8);
assert_eq!(x[4], 'o' as u8);
let z : &str = &"thing";
let z : &str = "thing";
assert_eq!(v, x);
assert!(x != z);
let a = &"aaaa";
let b = &"bbbb";
let a = "aaaa";
let b = "bbbb";
let c = &"cccc";
let cc = &"ccccc";
let c = "cccc";
let cc = "ccccc";
println!("{}", a);

View File

@ -16,7 +16,7 @@ fn perform_hax<T: 'static>(x: ~T) -> ~hax: {
}
fn deadcode() {
perform_hax(~~"deadcode");
perform_hax(~"deadcode".to_owned());
}
pub fn main() {

View File

@ -16,7 +16,7 @@ fn perform_hax<T: 'static>(x: ~T) -> ~hax: {
}
fn deadcode() {
perform_hax(~~"deadcode");
perform_hax(~"deadcode".to_owned());
}
pub fn main() {

View File

@ -44,15 +44,15 @@ fn g2(ref_1: &str, ref_2: &str) -> ~str {
pub fn main() {
assert_eq!(f1("b".to_owned()), "found b".to_owned());
assert_eq!(f1(&"c"), "not found".to_owned());
assert_eq!(f1("c"), "not found".to_owned());
assert_eq!(f1("d"), "not found".to_owned());
assert_eq!(f2("b".to_owned()), "found b".to_owned());
assert_eq!(f2(&"c"), "not found (c)".to_owned());
assert_eq!(f2("c"), "not found (c)".to_owned());
assert_eq!(f2("d"), "not found (d)".to_owned());
assert_eq!(g1("b".to_owned(), "c".to_owned()), "found b,c".to_owned());
assert_eq!(g1(&"c", &"d"), "not found".to_owned());
assert_eq!(g1("c", "d"), "not found".to_owned());
assert_eq!(g1("d", "e"), "not found".to_owned());
assert_eq!(g2("b".to_owned(), "c".to_owned()), "found b,c".to_owned());
assert_eq!(g2(&"c", &"d"), "not found (c, d)".to_owned());
assert_eq!(g2("c", "d"), "not found (c, d)".to_owned());
assert_eq!(g2("d", "e"), "not found (d, e)".to_owned());
}

View File

@ -22,8 +22,8 @@ macro_rules! check {
static S: $t = $e;
let v: $t = $e;
assert_eq!(S, v);
assert_eq!(format!("{:?}", v), ~$s);
assert_eq!(format!("{:?}", S), ~$s);
assert_eq!(format!("{:?}", v).as_slice(), $s);
assert_eq!(format!("{:?}", S).as_slice(), $s);
});*
}}
}