Skip to content

Commit 2d0daac

Browse files
Merge pull request #86 from PierreBhs/fix-c-cpp-book-typos
Fix typos in c-cpp-book markdown files
2 parents 01433aa + 1eca49a commit 2d0daac

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

c-cpp-book/src/ch05-data-structures.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ fn main() {
7474

7575
let d = &mut a;
7676

77-
/*
78-
* Uncommenting the line below would be cause the
79-
* program to not compile, because `b` is used
77+
/*
78+
* Uncommenting the line below would cause the
79+
* program to not compile, because `b` is used
8080
* while the mutable reference `d` is live in the current scope
8181
*
8282
* You cannot have a mutable and immutable reference in use in the same scope

c-cpp-book/src/ch07-ownership-and-borrowing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ graph LR
191191
- User defined data types can optionally opt into ```copy``` semantics using the ```derive``` macro with to automatically implement the ```Copy``` trait
192192
- The compiler will allocate space for the copy following a new assignment
193193
```rust
194-
// Try commenting this out to see the change in let p1 = p; belw
194+
// Try commenting this out to see the change in let p1 = p; below
195195
#[derive(Copy, Clone, Debug)] // We'll discuss this more later
196196
struct Point{x: u32, y:u32}
197197
fn main() {

c-cpp-book/src/ch08-crates-and-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ cargo new --lib hellolib
9797
```
9898

9999
## Exercise: Using workspaces and package dependencies
100-
- Take a look at the generated Cargo.toml in ```hello``` and ```hellolib```. Notice that both of them have been to the upper level ```Cargo.toml```
100+
- Take a look at the generated Cargo.toml in ```hello``` and ```hellolib```. Notice that both of them have been added to the upper level ```Cargo.toml```
101101
- The presence of ```lib.rs``` in ```hellolib``` implies a library package (see https://doc.rust-lang.org/cargo/reference/cargo-targets.html for customization options)
102102
- Adding a dependency on ```hellolib``` in ```Cargo.toml``` for ```hello```
103103
```toml

c-cpp-book/src/ch09-error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() {
4747
- Rust ```Option``` can be processed in various ways
4848
- ```unwrap()``` panics if the ```Option<T>``` is ```None``` and returns ```T``` otherwise and it is the least preferred approach
4949
- ```or()``` can be used to return an alternative value
50-
```if let``` lets us test for ```Some<T>```
50+
- ```if let``` lets us test for ```Some<T>```
5151

5252
> **Production patterns**: See [Safe value extraction with unwrap_or](ch17-2-avoiding-unchecked-indexing.md#safe-value-extraction-with-unwrap_or) and [Functional transforms: map, map_err, find_map](ch17-2-avoiding-unchecked-indexing.md#functional-transforms-map-map_err-find_map) for real-world examples from production Rust code.
5353
```rust
@@ -151,7 +151,7 @@ fn main() {
151151
----
152152
# Rust error handling
153153
- Rust errors can be irrecoverable (fatal) or recoverable. Fatal errors result in a ``panic```
154-
- In general, situation that result in ```panics``` should be avoided. ```panics``` are caused by bugs in the program, including exceeding index bounds, calling ```unwrap()``` on an ```Option<None>```, etc.
154+
- In general, situations that result in ```panics``` should be avoided. ```panics``` are caused by bugs in the program, including exceeding index bounds, calling ```unwrap()``` on an ```Option<None>```, etc.
155155
- It is OK to have explicit ```panics``` for conditions that should be impossible. The ```panic!``` or ```assert!``` macros can be used for sanity checks
156156
```rust
157157
fn main() {

0 commit comments

Comments
 (0)