Skip to content

Commit 523eff5

Browse files
committed
Fix warning: deprecated item
This sample throws a warning in line 36 currently, which does not appear to be intended: ``` warning: use of deprecated item: use `String::from` instead, #[warn(deprecated)] on by default ``` As making the suggested change produces this warning instead: ``` warning: unused or unknown feature, #[warn(unused_features)] on by default ``` ...the reference to `#![feature(collections)]` is removed as well.
1 parent a1abae9 commit 523eff5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

examples/std/str/str.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(collections)]
2-
31
fn main() {
42
// (all the type annotations are superfluous)
53
// A reference to a string allocated in read only memory
@@ -33,7 +31,7 @@ fn main() {
3331
println!("Used characters: {}", trimmed_str);
3432

3533
// Heap allocate a string
36-
let alice = String::from_str("I like dogs");
34+
let alice = String::from("I like dogs");
3735
// Allocate new memory and store the modified string there
3836
let bob: String = alice.replace("dog", "cat");
3937

0 commit comments

Comments
 (0)