Skip to content

Commit be48c05

Browse files
committed
Ch. 02: Consistent ordering of use statements
Adopt the idiomatic pattern of separating `std` from third-party `use` statements, with the result that we get the ordering we want for Ch. 07 for “free”. Fixes #3121
1 parent e380269 commit be48c05

File tree

7 files changed

+13
-6
lines changed
  • listings/ch02-guessing-game-tutorial

7 files changed

+13
-6
lines changed

listings/ch02-guessing-game-tutorial/listing-02-03/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ANCHOR: all
22
use std::io;
3+
34
// ANCHOR: ch07-04
45
use rand::Rng;
56

listings/ch02-guessing-game-tutorial/listing-02-04/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// ANCHOR: here
2-
use rand::Rng;
32
use std::cmp::Ordering;
43
use std::io;
54

5+
use rand::Rng;
6+
67
fn main() {
78
// --snip--
89
// ANCHOR_END: here

listings/ch02-guessing-game-tutorial/listing-02-05/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rand::Rng;
21
use std::cmp::Ordering;
32
use std::io;
43

4+
use rand::Rng;
5+
56
fn main() {
67
println!("Guess the number!");
78

listings/ch02-guessing-game-tutorial/listing-02-06/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rand::Rng;
21
use std::cmp::Ordering;
32
use std::io;
43

4+
use rand::Rng;
5+
56
fn main() {
67
println!("Guess the number!");
78

listings/ch02-guessing-game-tutorial/no-listing-03-convert-string-to-number/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rand::Rng;
21
use std::cmp::Ordering;
32
use std::io;
43

4+
use rand::Rng;
5+
56
fn main() {
67
println!("Guess the number!");
78

listings/ch02-guessing-game-tutorial/no-listing-04-looping/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rand::Rng;
21
use std::cmp::Ordering;
32
use std::io;
43

4+
use rand::Rng;
5+
56
fn main() {
67
println!("Guess the number!");
78

listings/ch02-guessing-game-tutorial/no-listing-05-quitting/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rand::Rng;
21
use std::cmp::Ordering;
32
use std::io;
43

4+
use rand::Rng;
5+
56
fn main() {
67
println!("Guess the number!");
78

0 commit comments

Comments
 (0)