mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-03-30 17:28:20 +02:00
Minor whitespace changes (#2595)
This commit is contained in:
parent
e1ed6eaf47
commit
6a25d7be04
@ -14,8 +14,10 @@ the referenced data cannot change.
|
|||||||
fn main() {
|
fn main() {
|
||||||
let a = 'A';
|
let a = 'A';
|
||||||
let b = 'B';
|
let b = 'B';
|
||||||
|
|
||||||
let mut r: &char = &a;
|
let mut r: &char = &a;
|
||||||
println!("r: {}", *r);
|
println!("r: {}", *r);
|
||||||
|
|
||||||
r = &b;
|
r = &b;
|
||||||
println!("r: {}", *r);
|
println!("r: {}", *r);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ fn main() {
|
|||||||
|
|
||||||
let mut s2: String = String::from("Hello ");
|
let mut s2: String = String::from("Hello ");
|
||||||
println!("s2: {s2}");
|
println!("s2: {s2}");
|
||||||
|
|
||||||
s2.push_str(s1);
|
s2.push_str(s1);
|
||||||
println!("s2: {s2}");
|
println!("s2: {s2}");
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ minutes: 10
|
|||||||
|
|
||||||
Like C and C++, Rust has support for custom structs:
|
Like C and C++, Rust has support for custom structs:
|
||||||
|
|
||||||
|
<!-- dprint-ignore-start -->
|
||||||
|
|
||||||
```rust,editable
|
```rust,editable
|
||||||
struct Person {
|
struct Person {
|
||||||
name: String,
|
name: String,
|
||||||
@ -17,7 +19,10 @@ fn describe(person: &Person) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut peter = Person { name: String::from("Peter"), age: 27 };
|
let mut peter = Person {
|
||||||
|
name: String::from("Peter"),
|
||||||
|
age: 27,
|
||||||
|
};
|
||||||
describe(&peter);
|
describe(&peter);
|
||||||
|
|
||||||
peter.age = 28;
|
peter.age = 28;
|
||||||
@ -30,6 +35,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<!-- dprint-ignore-end -->
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
Key Points:
|
Key Points:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user