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

src/libstd/str.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,12 +2031,12 @@ pub trait StrSlice<'a> {
20312031
/// # Example
20322032
///
20332033
/// ```rust
2034-
/// let s = ~"Do you know the muffin man,
2035-
/// The muffin man, the muffin man, ...";
2034+
/// let s = "Do you know the muffin man,
2035+
/// The muffin man, the muffin man, ...".to_owned();
20362036
///
20372037
/// assert_eq!(s.replace("muffin man", "little lamb"),
2038-
/// ~"Do you know the little lamb,
2039-
/// The little lamb, the little lamb, ...");
2038+
/// "Do you know the little lamb,
2039+
/// The little lamb, the little lamb, ...".to_owned());
20402040
///
20412041
/// // not found, so no change.
20422042
/// assert_eq!(s.replace("cookie monster", "little lamb"), s);
@@ -3606,11 +3606,11 @@ mod tests {
36063606

36073607
#[test]
36083608
fn test_total_ord() {
3609-
"1234".cmp(& &"123") == Greater;
3610-
"123".cmp(& &"1234") == Less;
3611-
"1234".cmp(& &"1234") == Equal;
3612-
"12345555".cmp(& &"123456") == Less;
3613-
"22".cmp(& &"1234") == Greater;
3609+
"1234".cmp(&("123")) == Greater;
3610+
"123".cmp(&("1234")) == Less;
3611+
"1234".cmp(&("1234")) == Equal;
3612+
"12345555".cmp(&("123456")) == Less;
3613+
"22".cmp(&("1234")) == Greater;
36143614
}
36153615

36163616
#[test]
@@ -4007,7 +4007,7 @@ mod tests {
40074007

40084008
#[test]
40094009
fn test_from_str() {
4010-
let owned: Option<~str> = from_str(&"string");
4010+
let owned: Option<~str> = from_str("string");
40114011
assert_eq!(owned, Some("string".to_owned()));
40124012
}
40134013

src/libstd/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<T: Clone> Vec<T> {
242242
///
243243
/// ```rust
244244
/// let mut vec = vec!("hello");
245-
/// vec.grow(2, & &"world");
245+
/// vec.grow(2, &("world"));
246246
/// assert_eq!(vec, vec!("hello", "world", "world"));
247247
/// ```
248248
pub fn grow(&mut self, n: uint, value: &T) {
@@ -267,8 +267,8 @@ impl<T: Clone> Vec<T> {
267267
///
268268
/// ```rust
269269
/// let mut vec = vec!("a", "b", "c");
270-
/// vec.grow_set(1, & &"fill", "d");
271-
/// vec.grow_set(4, & &"fill", "e");
270+
/// vec.grow_set(1, &("fill"), "d");
271+
/// vec.grow_set(4, &("fill"), "e");
272272
/// assert_eq!(vec, vec!("a", "d", "c", "fill", "e"));
273273
/// ```
274274
pub fn grow_set(&mut self, index: uint, initval: &T, value: T) {

src/liburl/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn encode_inner(s: &str, full_url: bool) -> ~str {
185185
* ```rust
186186
* use url::encode;
187187
*
188-
* let url = encode(&"https://example.com/Rust (programming language)");
188+
* let url = encode("https://example.com/Rust (programming language)");
189189
* println!("{}", url); // https://example.com/Rust%20(programming%20language)
190190
* ```
191191
*/
@@ -260,7 +260,7 @@ fn decode_inner(s: &str, full_url: bool) -> ~str {
260260
* ```rust
261261
* use url::decode;
262262
*
263-
* let url = decode(&"https://example.com/Rust%20(programming%20language)");
263+
* let url = decode("https://example.com/Rust%20(programming%20language)");
264264
* println!("{}", url); // https://example.com/Rust (programming language)
265265
* ```
266266
*/

src/test/compile-fail/borrowck-move-error-with-note.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl Drop for S {
3030
}
3131

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

src/test/compile-fail/const-cast-different-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
static a: &'static str = &"foo";
11+
static a: &'static str = "foo";
1212
static b: *u8 = a as *u8; //~ ERROR non-scalar cast
1313
static c: *u8 = &a as *u8; //~ ERROR mismatched types
1414

src/test/run-pass/auto-ref-slice-plus-ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn main() {
3333
(&[1]).test_imm();
3434
("test").test_imm();
3535
("test".to_owned()).test_imm();
36-
(&"test").test_imm();
36+
("test").test_imm();
3737

3838
// FIXME: Other types of mutable vecs don't currently exist
3939

src/test/run-pass/estr-slice.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111

1212
pub fn main() {
13-
let x = &"hello";
14-
let v = &"hello";
15-
let y : &str = &"there";
13+
let x = "hello";
14+
let v = "hello";
15+
let y : &str = "there";
1616

1717
println!("{}", x);
1818
println!("{}", y);
1919

2020
assert_eq!(x[0], 'h' as u8);
2121
assert_eq!(x[4], 'o' as u8);
2222

23-
let z : &str = &"thing";
23+
let z : &str = "thing";
2424
assert_eq!(v, x);
2525
assert!(x != z);
2626

27-
let a = &"aaaa";
28-
let b = &"bbbb";
27+
let a = "aaaa";
28+
let b = "bbbb";
2929

30-
let c = &"cccc";
31-
let cc = &"ccccc";
30+
let c = "cccc";
31+
let cc = "ccccc";
3232

3333
println!("{}", a);
3434

0 commit comments

Comments
 (0)