Skip to content

Commit

Permalink
fix: showing unnecessary x is never used warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
huss4in committed Sep 12, 2024
1 parent 2b7caf6 commit 9f15c1b
Show file tree
Hide file tree
Showing 28 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exercises/03_if/if1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

fn bigger(a: i32, b: i32) -> i32 {
// TODO: Complete this function to return the bigger number!
// If both numbers are equal, any of them can be returned.
Expand Down
2 changes: 2 additions & 0 deletions exercises/03_if/if2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// TODO: Fix the compiler error on this function.
fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
Expand Down
2 changes: 2 additions & 0 deletions exercises/03_if/if3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

fn animal_habitat(animal: &str) -> &str {
// TODO: Fix the compiler error in the statement below.
let identifier = if animal == "crab" {
Expand Down
2 changes: 2 additions & 0 deletions exercises/05_vecs/vecs1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

fn array_and_vec() -> ([i32; 4], Vec<i32>) {
let a = [10, 20, 30, 40]; // Array

Expand Down
2 changes: 2 additions & 0 deletions exercises/05_vecs/vecs2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

fn vec_loop(input: &[i32]) -> Vec<i32> {
let mut output = Vec::new();

Expand Down
2 changes: 2 additions & 0 deletions exercises/06_move_semantics/move_semantics1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// TODO: Fix the compiler error in this function.
fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
let vec = vec;
Expand Down
2 changes: 2 additions & 0 deletions exercises/06_move_semantics/move_semantics2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
let mut vec = vec;

Expand Down
2 changes: 2 additions & 0 deletions exercises/06_move_semantics/move_semantics3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// TODO: Fix the compiler error in the function without adding any new line.
fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
vec.push(88);
Expand Down
2 changes: 2 additions & 0 deletions exercises/07_structs/structs1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

struct ColorRegularStruct {
// TODO: Add the fields that the test `regular_structs` expects.
// What types should the fields have? What are the minimum and maximum values for RGB colors?
Expand Down
2 changes: 2 additions & 0 deletions exercises/07_structs/structs2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

#[derive(Debug)]
struct Order {
name: String,
Expand Down
2 changes: 2 additions & 0 deletions exercises/07_structs/structs3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// Structs contain data, but can also have logic. In this exercise, we have
// defined the `Package` struct, and we want to test some logic attached to it.

Expand Down
2 changes: 2 additions & 0 deletions exercises/08_enums/enums3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

struct Point {
x: u64,
y: u64,
Expand Down
2 changes: 2 additions & 0 deletions exercises/11_hashmaps/hashmaps2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// We're collecting different fruits to bake a delicious fruit cake. For this,
// we have a basket, which we'll represent in the form of a hash map. The key
// represents the name of each fruit we collect and the value represents how
Expand Down
2 changes: 2 additions & 0 deletions exercises/11_hashmaps/hashmaps3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// A list of scores (one per line) of a soccer match is given. Each line is of
// the form "<team_1_name>,<team_2_name>,<team_1_goals>,<team_2_goals>"
// Example: "England,France,4,2" (England scored 4 goals, France 2).
Expand Down
2 changes: 2 additions & 0 deletions exercises/13_error_handling/errors1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// TODO: This function refuses to generate text to be printed on a nametag if
// you pass it an empty string. It'd be nicer if it explained what the problem
// was instead of just returning `None`. Thankfully, Rust has a similar
Expand Down
2 changes: 2 additions & 0 deletions exercises/13_error_handling/errors4.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

#[derive(PartialEq, Debug)]
enum CreationError {
Negative,
Expand Down
2 changes: 2 additions & 0 deletions exercises/13_error_handling/errors6.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// Using catch-all error types like `Box<dyn Error>` isn't recommended for
// library code where callers might want to make decisions based on the error
// content instead of printing it out or propagating it further. Here, we define
Expand Down
2 changes: 2 additions & 0 deletions exercises/14_generics/generics2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// This powerful wrapper provides the ability to store a positive integer value.
// TODO: Rewrite it using a generic so that it supports wrapping ANY type.
struct Wrapper {
Expand Down
2 changes: 2 additions & 0 deletions exercises/15_traits/traits2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

trait AppendBar {
fn append_bar(self) -> Self;
}
Expand Down
2 changes: 2 additions & 0 deletions exercises/17_tests/tests1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// Tests are important to ensure that your code does what you think it should
// do.

Expand Down
2 changes: 2 additions & 0 deletions exercises/17_tests/tests2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// Calculates the power of 2 using a bit shift.
// `1 << n` is equivalent to "2 to the power of n".
fn power_of_2(n: u8) -> u64 {
Expand Down
2 changes: 2 additions & 0 deletions exercises/17_tests/tests3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

struct Rectangle {
width: i32,
height: i32,
Expand Down
2 changes: 2 additions & 0 deletions exercises/18_iterators/iterators3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

#[derive(Debug, PartialEq, Eq)]
enum DivisionError {
// Example: 42 / 0
Expand Down
2 changes: 2 additions & 0 deletions exercises/19_smart_pointers/cow1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// This exercise explores the `Cow` (Clone-On-Write) smart pointer. It can
// enclose and provide immutable access to borrowed data and clone the data
// lazily when mutation or ownership is required. The type is designed to work
Expand Down
2 changes: 2 additions & 0 deletions exercises/19_smart_pointers/rc1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// In this exercise, we want to express the concept of multiple owners via the
// `Rc<T>` type. This is a model of our solar system - there is a `Sun` type and
// multiple `Planet`s. The planets take ownership of the sun, indicating that
Expand Down
2 changes: 2 additions & 0 deletions exercises/quizzes/quiz1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// This is a quiz for the following sections:
// - Variables
// - Functions
Expand Down
2 changes: 2 additions & 0 deletions exercises/quizzes/quiz2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// This is a quiz for the following sections:
// - Strings
// - Vecs
Expand Down
2 changes: 2 additions & 0 deletions exercises/quizzes/quiz3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

// This quiz tests:
// - Generics
// - Traits
Expand Down

0 comments on commit 9f15c1b

Please sign in to comment.