From 521fb1cd682c389abb71b2ee19293f28cc0b4587 Mon Sep 17 00:00:00 2001 From: octavio telles teichner Date: Mon, 8 Jan 2024 16:46:37 -0300 Subject: [PATCH 1/2] Rephrase for clarity --- .../ch04-understanding-ownership/listing-04-03/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/listings/ch04-understanding-ownership/listing-04-03/src/main.rs b/listings/ch04-understanding-ownership/listing-04-03/src/main.rs index b001cc5f4a..28f5ca62cb 100644 --- a/listings/ch04-understanding-ownership/listing-04-03/src/main.rs +++ b/listings/ch04-understanding-ownership/listing-04-03/src/main.rs @@ -6,9 +6,9 @@ fn main() { let x = 5; // x comes into scope - makes_copy(x); // x would move into the function, - // but i32 is Copy, so it's okay to still - // use x afterward + makes_copy(x); // since i32 implements the Copy trait, + // x does NOT move into the function, + println!("{}", x); // so it's okay to use x afterward } // Here, x goes out of scope, then s. But because s's value was moved, nothing // special happens. From 52b9e2a0407bbc11842b0f950c1965eeaf675c2e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Wed, 27 Nov 2024 09:11:30 -0700 Subject: [PATCH 2/2] Match NoStarch style guide for updated Listing 4-3 comment --- listings/ch04-understanding-ownership/listing-04-03/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch04-understanding-ownership/listing-04-03/src/main.rs b/listings/ch04-understanding-ownership/listing-04-03/src/main.rs index 28f5ca62cb..0ab0171aff 100644 --- a/listings/ch04-understanding-ownership/listing-04-03/src/main.rs +++ b/listings/ch04-understanding-ownership/listing-04-03/src/main.rs @@ -6,7 +6,7 @@ fn main() { let x = 5; // x comes into scope - makes_copy(x); // since i32 implements the Copy trait, + makes_copy(x); // because i32 implements the Copy trait, // x does NOT move into the function, println!("{}", x); // so it's okay to use x afterward