Skip to content

Commit 2b3354c

Browse files
committed
book: add no_run and use statement to strings no-coercion example
1 parent 49597fc commit 2b3354c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/doc/trpl/strings.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ instead of `&str`. For example, [`TcpStream::connect`][connect] has a parameter
5454
of type `ToSocketAddrs`. A `&str` is okay but a `String` must be explicitly
5555
converted using `&*`.
5656

57-
```rust
57+
```rust,no_run
58+
use std::net::TcpStream;
59+
5860
TcpStream::connect("192.168.0.1:3000"); // &str parameter
5961
6062
let addr_string = "192.168.0.1:3000".to_string();

0 commit comments

Comments
 (0)