From 0513660b05e8dd45ba7bb25fff89b4fd089b14ea Mon Sep 17 00:00:00 2001 From: mo8it Date: Fri, 13 Sep 2024 14:56:46 +0200 Subject: [PATCH] Allow dead code for all exercises and solutions --- dev/Cargo.toml | 14 ++++++++------ exercises/08_enums/enums2.rs | 2 -- exercises/10_modules/modules2.rs | 1 - exercises/15_traits/traits3.rs | 2 -- exercises/19_smart_pointers/rc1.rs | 1 - solutions/08_enums/enums2.rs | 2 -- solutions/10_modules/modules2.rs | 1 - solutions/15_traits/traits3.rs | 2 -- solutions/19_smart_pointers/rc1.rs | 1 - 9 files changed, 8 insertions(+), 18 deletions(-) diff --git a/dev/Cargo.toml b/dev/Cargo.toml index 2accf3a..fbb093d 100644 --- a/dev/Cargo.toml +++ b/dev/Cargo.toml @@ -203,19 +203,21 @@ panic = "abort" panic = "abort" [lints.rust] -# You shouldn't write unsafe code in Rustlings +# You shouldn't write unsafe code in Rustlings! unsafe_code = "forbid" -# You don't need unstable features in Rustlings and shouldn't rely on them while learning Rust +# You don't need unstable features in Rustlings and shouldn't rely on them while learning Rust. unstable_features = "forbid" [lints.clippy] -# You forgot a `todo!()` +# You forgot a `todo!()`! todo = "forbid" -# This can only happen by mistake in Rustlings +# This can only happen by mistake in Rustlings. empty_loop = "forbid" -# No infinite loops are needed in Rustlings +# No infinite loops are needed in Rustlings. infinite_loop = "deny" -# You shouldn't leak memory while still learning Rust +# You shouldn't leak memory while still learning Rust! mem_forget = "deny" +# Dead code warnings can't be avoided in some exercises and might distract while learning. +dead_code = "allow" # Currently, there are no disallowed methods. This line avoids problems when developing Rustlings. disallowed_methods = "allow" diff --git a/exercises/08_enums/enums2.rs b/exercises/08_enums/enums2.rs index 29ed1b6..d70f639 100644 --- a/exercises/08_enums/enums2.rs +++ b/exercises/08_enums/enums2.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - #[derive(Debug)] struct Point { x: u64, diff --git a/exercises/10_modules/modules2.rs b/exercises/10_modules/modules2.rs index 02eb80a..782a70e 100644 --- a/exercises/10_modules/modules2.rs +++ b/exercises/10_modules/modules2.rs @@ -1,7 +1,6 @@ // You can bring module paths into scopes and provide new names for them with // the `use` and `as` keywords. -#[allow(dead_code)] mod delicious_snacks { // TODO: Add the following two `use` statements after fixing them. // use self::fruits::PEAR as ???; diff --git a/exercises/15_traits/traits3.rs b/exercises/15_traits/traits3.rs index 2e8969e..c244650 100644 --- a/exercises/15_traits/traits3.rs +++ b/exercises/15_traits/traits3.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - trait Licensed { // TODO: Add a default implementation for `licensing_info` so that // implementors like the two structs below can share that default behavior diff --git a/exercises/19_smart_pointers/rc1.rs b/exercises/19_smart_pointers/rc1.rs index 48e19dc..ecd3438 100644 --- a/exercises/19_smart_pointers/rc1.rs +++ b/exercises/19_smart_pointers/rc1.rs @@ -8,7 +8,6 @@ use std::rc::Rc; #[derive(Debug)] struct Sun; -#[allow(dead_code)] #[derive(Debug)] enum Planet { Mercury(Rc), diff --git a/solutions/08_enums/enums2.rs b/solutions/08_enums/enums2.rs index 2ee0553..07aee26 100644 --- a/solutions/08_enums/enums2.rs +++ b/solutions/08_enums/enums2.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - #[derive(Debug)] struct Point { x: u64, diff --git a/solutions/10_modules/modules2.rs b/solutions/10_modules/modules2.rs index 298d76e..55c316d 100644 --- a/solutions/10_modules/modules2.rs +++ b/solutions/10_modules/modules2.rs @@ -1,4 +1,3 @@ -#[allow(dead_code)] mod delicious_snacks { // Added `pub` and used the expected alias after `as`. pub use self::fruits::PEAR as fruit; diff --git a/solutions/15_traits/traits3.rs b/solutions/15_traits/traits3.rs index 747d919..3d8ec85 100644 --- a/solutions/15_traits/traits3.rs +++ b/solutions/15_traits/traits3.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - trait Licensed { fn licensing_info(&self) -> String { "Default license".to_string() diff --git a/solutions/19_smart_pointers/rc1.rs b/solutions/19_smart_pointers/rc1.rs index 512eb9c..c0a41ab 100644 --- a/solutions/19_smart_pointers/rc1.rs +++ b/solutions/19_smart_pointers/rc1.rs @@ -8,7 +8,6 @@ use std::rc::Rc; #[derive(Debug)] struct Sun; -#[allow(dead_code)] #[derive(Debug)] enum Planet { Mercury(Rc),