Skip to content

Commit 7852625

Browse files
committed
remove leftover obsolete string literals
1 parent 4baff4e commit 7852625

File tree

21 files changed

+70
-70
lines changed

21 files changed

+70
-70
lines changed

src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn parse_compile_flags(line: &str) -> Option<~str> {
170170
}
171171

172172
fn parse_run_flags(line: &str) -> Option<~str> {
173-
parse_name_value_directive(line, ~"run-flags")
173+
parse_name_value_directive(line, "run-flags".to_owned())
174174
}
175175

176176
fn parse_debugger_cmd(line: &str) -> Option<~str> {

src/libcollections/hashmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,13 +698,13 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
698698
/// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot.");
699699
///
700700
/// // check for a specific one.
701-
/// if !book_reviews.contains_key(& &"Les Misérables") {
701+
/// if !book_reviews.contains_key(&("Les Misérables")) {
702702
/// println!("We've got {} reviews, but Les Misérables ain't one.",
703703
/// book_reviews.len());
704704
/// }
705705
///
706706
/// // oops, this review has a lot of spelling mistakes, let's delete it.
707-
/// book_reviews.remove(& &"The Adventures of Sherlock Holmes");
707+
/// book_reviews.remove(&("The Adventures of Sherlock Holmes"));
708708
///
709709
/// // look up the values associated with some keys.
710710
/// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"];

src/libcollections/treemap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,10 @@ mod test_set {
16511651

16521652
// FIXME: #5801: this needs a type hint to compile...
16531653
let result: Option<(&uint, & &'static str)> = z.next();
1654-
assert_eq!(result.unwrap(), (&5u, & &"bar"));
1654+
assert_eq!(result.unwrap(), (&5u, &("bar")));
16551655

16561656
let result: Option<(&uint, & &'static str)> = z.next();
1657-
assert_eq!(result.unwrap(), (&11u, & &"foo"));
1657+
assert_eq!(result.unwrap(), (&11u, &("foo")));
16581658

16591659
let result: Option<(&uint, & &'static str)> = z.next();
16601660
assert!(result.is_none());

src/libgetopts/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ mod tests {
14411441
optmulti("l", "", "Desc", "VAL"));
14421442

14431443
let expected =
1444-
~"Usage: fruits
1444+
"Usage: fruits
14451445
14461446
Options:
14471447
-b --banana VAL Desc
@@ -1450,7 +1450,7 @@ Options:
14501450
-k --kiwi Desc
14511451
-p [VAL] Desc
14521452
-l VAL Desc
1453-
";
1453+
".to_owned();
14541454

14551455
let generated_usage = usage("Usage: fruits", optgroups.as_slice());
14561456

@@ -1471,13 +1471,13 @@ Options:
14711471
"This is a long description which _will_ be wrapped..+.."));
14721472

14731473
let expected =
1474-
~"Usage: fruits
1474+
"Usage: fruits
14751475
14761476
Options:
14771477
-k --kiwi This is a long description which won't be wrapped..+..
14781478
-a --apple This is a long description which _will_ be
14791479
wrapped..+..
1480-
";
1480+
".to_owned();
14811481

14821482
let usage = usage("Usage: fruits", optgroups.as_slice());
14831483

@@ -1496,14 +1496,14 @@ Options:
14961496
confuse the line wrapping; an apple costs 0.51€ in some parts of Europe."));
14971497

14981498
let expected =
1499-
~"Usage: fruits
1499+
"Usage: fruits
15001500
15011501
Options:
15021502
-k --k–w– The word kiwi is normally spelled with two i's
15031503
-a --apple This “description” has some characters that could
15041504
confuse the line wrapping; an apple costs 0.51€ in
15051505
some parts of Europe.
1506-
";
1506+
".to_owned();
15071507

15081508
let usage = usage("Usage: fruits", optgroups.as_slice());
15091509

src/libregex_macros/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a> NfaGen<'a> {
116116
|cx, name| match name {
117117
&Some(ref name) => {
118118
let name = name.as_slice();
119-
quote_expr!(cx, Some(~$name))
119+
quote_expr!(cx, Some($name.to_owned()))
120120
}
121121
&None => quote_expr!(cx, None),
122122
}
@@ -306,7 +306,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
306306
}
307307

308308
::regex::Regex {
309-
original: ~$regex,
309+
original: $regex.to_owned(),
310310
names: vec!$cap_names,
311311
p: ::regex::native::Native(exec),
312312
}

src/libserialize/json.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,16 +2629,16 @@ mod tests {
26292629
assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2)));
26302630
assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5)));
26312631

2632-
assert_eq!(from_str("\"\""), Ok(String(~"")));
2633-
assert_eq!(from_str("\"foo\""), Ok(String(~"foo")));
2634-
assert_eq!(from_str("\"\\\"\""), Ok(String(~"\"")));
2635-
assert_eq!(from_str("\"\\b\""), Ok(String(~"\x08")));
2636-
assert_eq!(from_str("\"\\n\""), Ok(String(~"\n")));
2637-
assert_eq!(from_str("\"\\r\""), Ok(String(~"\r")));
2638-
assert_eq!(from_str("\"\\t\""), Ok(String(~"\t")));
2639-
assert_eq!(from_str(" \"foo\" "), Ok(String(~"foo")));
2640-
assert_eq!(from_str("\"\\u12ab\""), Ok(String(~"\u12ab")));
2641-
assert_eq!(from_str("\"\\uAB12\""), Ok(String(~"\uAB12")));
2632+
assert_eq!(from_str("\"\""), Ok(String("".to_owned())));
2633+
assert_eq!(from_str("\"foo\""), Ok(String("foo".to_owned())));
2634+
assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_owned())));
2635+
assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_owned())));
2636+
assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_owned())));
2637+
assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_owned())));
2638+
assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_owned())));
2639+
assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_owned())));
2640+
assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u12ab".to_owned())));
2641+
assert_eq!(from_str("\"\\uAB12\""), Ok(String("\uAB12".to_owned())));
26422642
}
26432643

26442644
#[test]
@@ -2902,23 +2902,23 @@ mod tests {
29022902
fn test_find(){
29032903
let json_value = from_str("{\"dog\" : \"cat\"}").unwrap();
29042904
let found_str = json_value.find(&"dog".to_owned());
2905-
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == &"cat");
2905+
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cat");
29062906
}
29072907

29082908
#[test]
29092909
fn test_find_path(){
29102910
let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap();
29112911
let found_str = json_value.find_path(&[&"dog".to_owned(),
29122912
&"cat".to_owned(), &"mouse".to_owned()]);
2913-
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == &"cheese");
2913+
assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cheese");
29142914
}
29152915

29162916
#[test]
29172917
fn test_search(){
29182918
let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap();
29192919
let found_str = json_value.search(&"mouse".to_owned()).and_then(|j| j.as_string());
29202920
assert!(found_str.is_some());
2921-
assert!(found_str.unwrap() == &"cheese");
2921+
assert!(found_str.unwrap() == "cheese");
29222922
}
29232923

29242924
#[test]
@@ -2958,7 +2958,7 @@ mod tests {
29582958
fn test_as_string(){
29592959
let json_value = from_str("\"dog\"").unwrap();
29602960
let json_str = json_value.as_string();
2961-
let expected_str = &"dog";
2961+
let expected_str = "dog";
29622962
assert_eq!(json_str, Some(expected_str));
29632963
}
29642964

@@ -3079,7 +3079,7 @@ mod tests {
30793079
r#"{ "foo":"bar", "array" : [0, 1, 2,3 ,4,5], "idents":[null,true,false]}"#,
30803080
~[
30813081
(ObjectStart, ~[]),
3082-
(StringValue(~"bar"), ~[Key("foo")]),
3082+
(StringValue("bar".to_owned()), ~[Key("foo")]),
30833083
(ListStart, ~[Key("array")]),
30843084
(NumberValue(0.0), ~[Key("array"), Index(0)]),
30853085
(NumberValue(1.0), ~[Key("array"), Index(1)]),
@@ -3167,7 +3167,7 @@ mod tests {
31673167
(NumberValue(1.0), ~[Key("a")]),
31683168
(ListStart, ~[Key("b")]),
31693169
(BooleanValue(true), ~[Key("b"), Index(0)]),
3170-
(StringValue(~"foo\nbar"), ~[Key("b"), Index(1)]),
3170+
(StringValue("foo\nbar".to_owned()), ~[Key("b"), Index(1)]),
31713171
(ObjectStart, ~[Key("b"), Index(2)]),
31723172
(ObjectStart, ~[Key("b"), Index(2), Key("c")]),
31733173
(NullValue, ~[Key("b"), Index(2), Key("c"), Key("d")]),
@@ -3299,7 +3299,7 @@ mod tests {
32993299
assert!(stack.last_is_index());
33003300
assert!(stack.get(0) == Index(1));
33013301

3302-
stack.push_key(~"foo");
3302+
stack.push_key("foo".to_owned());
33033303

33043304
assert!(stack.len() == 2);
33053305
assert!(stack.is_equal_to([Index(1), Key("foo")]));
@@ -3311,7 +3311,7 @@ mod tests {
33113311
assert!(stack.get(0) == Index(1));
33123312
assert!(stack.get(1) == Key("foo"));
33133313

3314-
stack.push_key(~"bar");
3314+
stack.push_key("bar".to_owned());
33153315

33163316
assert!(stack.len() == 3);
33173317
assert!(stack.is_equal_to([Index(1), Key("foo"), Key("bar")]));
@@ -3375,7 +3375,7 @@ mod tests {
33753375
}
33763376

33773377
fn big_json() -> ~str {
3378-
let mut src = ~"[\n";
3378+
let mut src = "[\n".to_owned();
33793379
for _ in range(0, 500) {
33803380
src = src + r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": [1,2,3]},"#;
33813381
}

src/libstd/bitflags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
//! let mut flags = FlagA | FlagB;
6363
//! flags.clear();
6464
//! assert!(flags.is_empty());
65-
//! assert_eq!(format!("{}", flags), ~"hi!");
65+
//! assert_eq!(format!("{}", flags).as_slice(), "hi!");
6666
//! }
6767
//! ~~~
6868
//!

src/libstd/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ mod tests {
343343

344344
assert_eq!(hasher.hash(&'a'), 97);
345345

346-
assert_eq!(hasher.hash(& &"a"), 97 + 0xFF);
346+
assert_eq!(hasher.hash(&("a")), 97 + 0xFF);
347347
assert_eq!(hasher.hash(& &[1u8, 2u8, 3u8]), 9);
348348

349349
unsafe {

src/libstd/path/posix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ mod tests {
560560
($path:expr, $disp:ident, $exp:expr) => (
561561
{
562562
let path = Path::new($path);
563-
assert!(path.$disp().to_str() == ~$exp);
563+
assert!(path.$disp().to_str().as_slice() == $exp);
564564
}
565565
)
566566
)

src/libstd/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ fn test_repr() {
637637
exact_test(&true, "true");
638638
exact_test(&false, "false");
639639
exact_test(&1.234, "1.234f64");
640-
exact_test(&(&"hello"), "\"hello\"");
640+
exact_test(&("hello"), "\"hello\"");
641641
// FIXME What do I do about this one?
642642
exact_test(&("he\u10f3llo".to_owned()), "~\"he\\u10f3llo\"");
643643

0 commit comments

Comments
 (0)