Skip to content

Commit 0513660

Browse files
committed
Allow dead code for all exercises and solutions
1 parent 3947c4d commit 0513660

File tree

9 files changed

+8
-18
lines changed

9 files changed

+8
-18
lines changed

dev/Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,21 @@ panic = "abort"
203203
panic = "abort"
204204

205205
[lints.rust]
206-
# You shouldn't write unsafe code in Rustlings
206+
# You shouldn't write unsafe code in Rustlings!
207207
unsafe_code = "forbid"
208-
# You don't need unstable features in Rustlings and shouldn't rely on them while learning Rust
208+
# You don't need unstable features in Rustlings and shouldn't rely on them while learning Rust.
209209
unstable_features = "forbid"
210210

211211
[lints.clippy]
212-
# You forgot a `todo!()`
212+
# You forgot a `todo!()`!
213213
todo = "forbid"
214-
# This can only happen by mistake in Rustlings
214+
# This can only happen by mistake in Rustlings.
215215
empty_loop = "forbid"
216-
# No infinite loops are needed in Rustlings
216+
# No infinite loops are needed in Rustlings.
217217
infinite_loop = "deny"
218-
# You shouldn't leak memory while still learning Rust
218+
# You shouldn't leak memory while still learning Rust!
219219
mem_forget = "deny"
220+
# Dead code warnings can't be avoided in some exercises and might distract while learning.
221+
dead_code = "allow"
220222
# Currently, there are no disallowed methods. This line avoids problems when developing Rustlings.
221223
disallowed_methods = "allow"

exercises/08_enums/enums2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
#[derive(Debug)]
42
struct Point {
53
x: u64,

exercises/10_modules/modules2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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)]
54
mod delicious_snacks {
65
// TODO: Add the following two `use` statements after fixing them.
76
// use self::fruits::PEAR as ???;

exercises/15_traits/traits3.rs

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

exercises/19_smart_pointers/rc1.rs

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

11-
#[allow(dead_code)]
1211
#[derive(Debug)]
1312
enum Planet {
1413
Mercury(Rc<Sun>),

solutions/08_enums/enums2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
#[derive(Debug)]
42
struct Point {
53
x: u64,

solutions/10_modules/modules2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[allow(dead_code)]
21
mod delicious_snacks {
32
// Added `pub` and used the expected alias after `as`.
43
pub use self::fruits::PEAR as fruit;

solutions/15_traits/traits3.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
trait Licensed {
42
fn licensing_info(&self) -> String {
53
"Default license".to_string()

solutions/19_smart_pointers/rc1.rs

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

11-
#[allow(dead_code)]
1211
#[derive(Debug)]
1312
enum Planet {
1413
Mercury(Rc<Sun>),

0 commit comments

Comments
 (0)