Skip to content

Commit 612b7ba

Browse files
romain-at-adacoreDana Binkley
authored andcommitted
Apply single quotes to code inside comments
1 parent 76f7b20 commit 612b7ba

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

  • courses/rust_essentials/110_common_library_types/lab

courses/rust_essentials/110_common_library_types/lab/answer/src/main.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
#[allow(unused_variables)]
66
fn main() {
77

8-
// TASK 1 - Option Type Handling
9-
// Hint: Option<T> must be explicitly handled
8+
// TASK 1 - 'Option' Type Handling
9+
// Hint: 'Option<T>' must be explicitly handled
1010
let maybe_number = Some(42);
1111
let result = match maybe_number {
1212
Some(v) => v + 10,
1313
None => 0,
1414
};
1515
println!("TASK1 => result: {}", result);
1616

17-
// TASK 2 - Result Variants
18-
// Hint: Result uses Ok(T) and Err(E)
17+
// TASK 2 - 'Result' Variants
18+
// Hint: 'Result' uses 'Ok(T)' and 'Err(E)'
1919
fn check_positive(num: i32) -> Result<i32, String> {
2020
if num > 0 {
2121
Ok(num) // Replaced Some with Ok
@@ -25,27 +25,27 @@ fn main() {
2525
}
2626
println!("TASK2 => check: {:?}", check_positive(-5));
2727

28-
// TASK 3 - String vs &str
29-
// Hint: &str is a fixed view, an owned and growable String is needed to append text
30-
let mut greeting = String::from("Hello"); // Converted to an owned String
28+
// TASK 3 - 'String' vs '&str'
29+
// Hint: '&str' is a fixed view, an owned and growable 'String' is needed to append text
30+
let mut greeting = String::from("Hello"); // Converted to an owned 'String'
3131
greeting.push_str(" world");
3232
println!("TASK3 => greeting: {}", greeting);
3333

34-
// TASK 4 - Modifying Strings (push vs push_str)
35-
// Hint: Which String method appends a slice instead of a single char?
34+
// TASK 4 - Modifying Strings ('push' vs 'push_str')
35+
// Hint: Which 'String' method appends a slice instead of a single 'char'?
3636
let mut text = String::from("Rust");
37-
text.push_str(" is great"); // Changed push to push_str
37+
text.push_str(" is great"); // Changed 'push' to 'push_str'
3838
println!("TASK4 => text: {}", text);
3939

4040
// TASK 5 - Vector Creation Macro
4141
// Hint: How is a macro invoked differently than a function?
42-
let numbers = vec![1, 2, 3]; // Added ! to properly invoke the macro
42+
let numbers = vec![1, 2, 3]; // Added '!' to properly invoke the macro
4343
println!("TASK5 => numbers length: {}", numbers.len());
4444

4545
// TASK 6 - Representing Absence
46-
// Hint: Rust does not have null pointers, absence is represented by the appropriate Option variant
46+
// Hint: Rust does not have null pointers, absence is represented by the appropriate 'Option' variant
4747
fn get_user(id: u32) -> Option<String> {
48-
None // Replaced null with None
48+
None // Replaced null with 'None'
4949
}
5050
println!("TASK6 => get_user(1): {:?}", get_user(1));
5151

courses/rust_essentials/110_common_library_types/lab/prompt/src/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
#[allow(unused_variables)]
88
fn main() {
99

10-
// TASK 1 - Option Type Handling
11-
// Hint: Option<T> must be explicitly handled
10+
// TASK 1 - 'Option' Type Handling
11+
// Hint: 'Option<T>' must be explicitly handled
1212
let maybe_number = Some(42);
1313
let result = maybe_number + 10;
1414

15-
// TASK 2 - Result Variants
16-
// Hint: Result uses Ok(T) and Err(E)
15+
// TASK 2 - 'Result' Variants
16+
// Hint: 'Result' uses 'Ok(T)' and 'Err(E)'
1717
fn check_positive(num: i32) -> Result<i32, String> {
1818
if num > 0 {
1919
Some(num)
@@ -22,13 +22,13 @@ fn main() {
2222
}
2323
}
2424

25-
// TASK 3 - String vs &str
26-
// Hint: &str is a fixed view, an owned and growable String is needed to append text
25+
// TASK 3 - 'String' vs '&str'
26+
// Hint: '&str' is a fixed view, an owned and growable 'String' is needed to append text
2727
let mut greeting = "Hello";
2828
greeting.push_str(" world");
2929

30-
// TASK 4 - Modifying Strings (push vs push_str)
31-
// Hint: Which String method appends a slice instead of a single char?
30+
// TASK 4 - Modifying Strings ('push' vs 'push_str')
31+
// Hint: Which 'String' method appends a slice instead of a single 'char'?
3232
let mut text = String::from("Rust");
3333
text.push(" is great");
3434

@@ -37,7 +37,7 @@ fn main() {
3737
let numbers = vec[1, 2, 3];
3838

3939
// TASK 6 - Representing Absence
40-
// Hint: Rust does not have null pointers, absence is represented by the appropriate Option variant
40+
// Hint: Rust does not have null pointers, absence is represented by the appropriate 'Option' variant
4141
fn get_user(id: u32) -> Option<String> {
4242
null
4343
}

0 commit comments

Comments
 (0)