Messy snapshots of other chapters with indentation fixed

This commit is contained in:
Carol (Nichols || Goulding) 2022-08-23 20:15:07 -04:00 committed by Carol (Nichols || Goulding)
parent 55ee77aecd
commit 59926b9912
4 changed files with 21 additions and 16 deletions

View File

@ -1,3 +1,8 @@
<!-- DO NOT EDIT THIS FILE.
This file is periodically generated from the content in the `/src/`
directory, so all fixes need to be made in `/src/`.
-->
[TOC]
@ -360,11 +365,11 @@ program asks a user to show how many spaces they want between some text by
inputting space characters, and then we want to store that input as a number:
```
let spaces = " ";
let spaces = " ";
```
```
let spaces = spaces.len();
let spaces = spaces.len();
```
The first `spaces` variable is a string type and the second `spaces` variable
@ -374,11 +379,11 @@ the simpler `spaces` name. However, if we try to use `mut` for this, as shown
here, well get a compile-time error:
```
let mut spaces = " ";
let mut spaces = " ";
```
```
spaces = spaces.len();
spaces = spaces.len();
```
The error says were not allowed to mutate a variables type:

View File

@ -306,11 +306,11 @@ Multiple variables can interact with the same data in different ways in Rust.
Lets look at an example using an integer in Listing 4-2.
```
let x = 5;
let x = 5;
```
```
let y = x;
let y = x;
```
Assigning the integer value of variable `x` to `y`
@ -324,11 +324,11 @@ onto the stack.
Now lets look at the `String` version:
```
let s1 = String::from("hello");
let s1 = String::from("hello");
```
```
let s2 = s1;
let s2 = s1;
```
This looks very similar, so we might assume that the way it works would be the
@ -423,7 +423,7 @@ error[E0382]: borrow of moved value: `s1`
```
```
does not implement the `Copy` trait
does not implement the `Copy` trait
```
```
@ -1115,7 +1115,7 @@ attempts to create two mutable references to `s` will fail:
Filename: src/main.rs
```
let mut s = String::from("hello");
let mut s = String::from("hello");
```
```
@ -1123,11 +1123,11 @@ Filename: src/main.rs
```
```
let r1 = &mut s;
let r1 = &mut s;
```
```
let r2 = &mut s;
let r2 = &mut s;
```
```
@ -1135,7 +1135,7 @@ Filename: src/main.rs
```
```
println!("{r1}, {r2}");
println!("{r1}, {r2}");
```
Heres the error:
@ -1726,7 +1726,7 @@ Luckily, Rust has a solution to this problem: string slices.
A *string slice* is a reference to part of a `String`, and it looks like this:
```
let s = String::from("hello world");
let s = String::from("hello world");
```
```
@ -1734,11 +1734,11 @@ A *string slice* is a reference to part of a `String`, and it looks like this:
```
```
let hello = &s[0..5];
let hello = &s[0..5];
```
```
let world = &s[6..11];
let world = &s[6..11];
```
Rather than a reference to the entire `String`, `hello` is a reference to a

Binary file not shown.

Binary file not shown.