Skip to content

Commit b87aa98

Browse files
committed
Fix warnings
1 parent a4c07ca commit b87aa98

File tree

18 files changed

+28
-8
lines changed

18 files changed

+28
-8
lines changed

exercises/06_move_semantics/move_semantics5.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::ptr_arg)]
2+
13
// TODO: Fix the compiler errors without changing anything except adding or
24
// removing references (the character `&`).
35

exercises/08_enums/enums2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#[allow(dead_code)]
12
#[derive(Debug)]
23
enum Message {
34
// TODO: Define the different variants used below.
45
}
56

67
impl Message {
78
fn call(&self) {
8-
println!("{:?}", self);
9+
println!("{self:?}");
910
}
1011
}
1112

exercises/10_modules/modules2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// You can bring module paths into scopes and provide new names for them with
22
// the `use` and `as` keywords.
33

4+
#[allow(dead_code)]
45
mod delicious_snacks {
56
// TODO: Add the following two `use` statements after fixing them.
67
// use self::fruits::PEAR as ???;

exercises/13_error_handling/errors4.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::comparison_chain)]
2+
13
#[derive(PartialEq, Debug)]
24
enum CreationError {
35
Negative,

exercises/13_error_handling/errors6.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl PositiveNonzeroInteger {
3535
fn new(value: i64) -> Result<Self, CreationError> {
3636
match value {
3737
x if x < 0 => Err(CreationError::Negative),
38-
x if x == 0 => Err(CreationError::Zero),
38+
0 => Err(CreationError::Zero),
3939
x => Ok(Self(x as u64)),
4040
}
4141
}
@@ -55,7 +55,6 @@ fn main() {
5555
#[cfg(test)]
5656
mod test {
5757
use super::*;
58-
use std::num::IntErrorKind;
5958

6059
#[test]
6160
fn test_parse_error() {

exercises/15_traits/traits3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(dead_code)]
2+
13
trait Licensed {
24
// TODO: Add a default implementation for `licensing_info` so that
35
// implementors like the two structs below can share that default behavior

exercises/19_smart_pointers/rc1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::rc::Rc;
88
#[derive(Debug)]
99
struct Sun;
1010

11+
#[allow(dead_code)]
1112
#[derive(Debug)]
1213
enum Planet {
1314
Mercury(Rc<Sun>),

solutions/01_variables/variables3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::needless_late_init)]
2+
13
fn main() {
24
// Reading uninitialized variables isn't allowed in Rust!
35
// Therefore, we need to assign a value first.

solutions/06_move_semantics/move_semantics5.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::ptr_arg)]
2+
13
fn main() {
24
let data = "Rust is great!".to_string();
35

solutions/08_enums/enums2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[allow(dead_code)]
12
#[derive(Debug)]
23
enum Message {
34
Move { x: i64, y: i64 },
@@ -8,7 +9,7 @@ enum Message {
89

910
impl Message {
1011
fn call(&self) {
11-
println!("{:?}", self);
12+
println!("{self:?}");
1213
}
1314
}
1415

0 commit comments

Comments
 (0)