Skip to content

Commit d81d4f1

Browse files
committed
manual: remove as many ~"" literals as possible.
1 parent 0b1a401 commit d81d4f1

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

doc/rust.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,8 @@ fn main() {
859859
log(info, Some(1.0));
860860
861861
// Equivalent to 'log(core::info,
862-
// core::str::to_upper(core::str::slice(~"foo", 0u, 1u)));'
863-
log(info, to_upper(slice(~"foo", 0u, 1u)));
862+
// core::str::to_upper(core::str::slice("foo", 0u, 1u)));'
863+
log(info, to_upper(slice("foo", 0u, 1u)));
864864
}
865865
~~~~
866866

@@ -1050,14 +1050,14 @@ were declared without the `!` annotation, the following code would not
10501050
typecheck:
10511051

10521052
~~~~
1053-
# fn my_err(s: ~str) -> ! { fail }
1053+
# fn my_err(s: &str) -> ! { fail }
10541054
10551055
fn f(i: int) -> int {
10561056
if i == 42 {
10571057
return 42;
10581058
}
10591059
else {
1060-
my_err(~"Bad number!");
1060+
my_err("Bad number!");
10611061
}
10621062
}
10631063
~~~~
@@ -1502,7 +1502,7 @@ string, boolean value, or the nil value.
15021502

15031503
~~~~~~~~ {.literals}
15041504
(); // nil type
1505-
~"hello"; // string type
1505+
"hello"; // string type
15061506
'5'; // character type
15071507
5; // integer type
15081508
~~~~~~~~
@@ -1520,7 +1520,7 @@ values.
15201520

15211521
~~~~~~~~ {.tuple}
15221522
(0f, 4.5f);
1523-
(~"a", 4u, true);
1523+
("a", 4u, true);
15241524
~~~~~~~~
15251525

15261526
### Record expressions
@@ -1539,8 +1539,8 @@ written before its name.
15391539

15401540
~~~~
15411541
{x: 10f, y: 20f};
1542-
{name: ~"Joe", age: 35u, score: 100_000};
1543-
{ident: ~"X", mut count: 0u};
1542+
{name: "Joe", age: 35u, score: 100_000};
1543+
{ident: "X", mut count: 0u};
15441544
~~~~
15451545

15461546
The order of the fields in a record expression is significant, and
@@ -1609,7 +1609,7 @@ When no mutability is specified, the vector is immutable.
16091609

16101610
~~~~
16111611
~[1, 2, 3, 4];
1612-
~[~"a", ~"b", ~"c", ~"d"];
1612+
~["a", "b", "c", "d"];
16131613
~[mut 0u8, 0u8, 0u8, 0u8];
16141614
~~~~
16151615

@@ -1633,7 +1633,7 @@ task in a _failing state_.
16331633
16341634
(~[1, 2, 3, 4])[0];
16351635
(~[mut 'x', 'y'])[1] = 'z';
1636-
(~[~"a", ~"b"])[10]; // fails
1636+
(~["a", "b"])[10]; // fails
16371637
16381638
# }
16391639
~~~~
@@ -2034,7 +2034,7 @@ An example:
20342034
let mut i = 0;
20352035
20362036
while i < 10 {
2037-
io::println(~"hello\n");
2037+
io::println("hello\n");
20382038
i = i + 1;
20392039
}
20402040
~~~~
@@ -2281,9 +2281,9 @@ range of values may be specified with `..`. For example:
22812281
# let x = 2;
22822282
22832283
let message = match x {
2284-
0 | 1 => ~"not many",
2285-
2 .. 9 => ~"a few",
2286-
_ => ~"lots"
2284+
0 | 1 => "not many",
2285+
2 .. 9 => "a few",
2286+
_ => "lots"
22872287
};
22882288
~~~~
22892289

@@ -2366,7 +2366,7 @@ The following examples all produce the same output, logged at the `error`
23662366
logging level:
23672367

23682368
~~~~
2369-
# let filename = ~"bulbasaur";
2369+
# let filename = "bulbasaur";
23702370
23712371
// Full version, logging a value.
23722372
log(core::error, ~"file not found: " + filename);

0 commit comments

Comments
 (0)