From 7949362c36b8ea803da796e23ca39d4d11a5b87e Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sun, 10 Sep 2023 16:59:01 +0200 Subject: [PATCH] Use todo!() instead of unimplemented!() The difference is one of intent, and the actual panic message. See the docs why todo is more appropriate: https://doc.rust-lang.org/stable/std/macro.todo.html [no important files changed] closes #1598 --- concepts/structs/about.md | 2 +- exercises/concept/assembly-line/src/lib.rs | 4 +-- exercises/concept/csv-builder/src/lib.rs | 6 ++--- .../health-statistics/.docs/introduction.md | 2 +- .../concept/health-statistics/src/lib.rs | 12 ++++----- .../low-power-embedded-game/.docs/hints.md | 2 +- .../low-power-embedded-game/src/lib.rs | 6 ++--- .../lucians-luscious-lasagna/src/lib.rs | 8 +++--- .../magazine-cutout/.docs/instructions.md | 2 +- exercises/concept/magazine-cutout/src/lib.rs | 2 +- exercises/concept/resistor-color/src/lib.rs | 6 ++--- .../concept/role-playing-game/src/lib.rs | 4 +-- .../rpn-calculator/.docs/instructions.md | 2 +- exercises/concept/rpn-calculator/src/lib.rs | 2 +- .../concept/semi-structured-logs/src/lib.rs | 8 +++--- exercises/concept/short-fibonacci/src/lib.rs | 6 ++--- exercises/practice/accumulate/src/lib.rs | 2 +- exercises/practice/acronym/src/lib.rs | 2 +- exercises/practice/affine-cipher/src/lib.rs | 4 +-- exercises/practice/all-your-base/src/lib.rs | 2 +- exercises/practice/allergies/src/lib.rs | 6 ++--- exercises/practice/alphametics/src/lib.rs | 2 +- exercises/practice/anagram/src/lib.rs | 4 +-- .../practice/armstrong-numbers/src/lib.rs | 2 +- exercises/practice/atbash-cipher/src/lib.rs | 4 +-- exercises/practice/beer-song/src/lib.rs | 4 +-- exercises/practice/binary-search/src/lib.rs | 2 +- exercises/practice/bob/src/lib.rs | 2 +- exercises/practice/book-store/src/lib.rs | 2 +- exercises/practice/bowling/src/lib.rs | 6 ++--- exercises/practice/circular-buffer/src/lib.rs | 10 +++---- exercises/practice/clock/src/lib.rs | 4 +-- .../practice/collatz-conjecture/src/lib.rs | 4 +-- exercises/practice/crypto-square/src/lib.rs | 2 +- exercises/practice/custom-set/src/lib.rs | 18 ++++++------- exercises/practice/decimal/src/lib.rs | 2 +- exercises/practice/diamond/src/lib.rs | 4 +-- .../practice/difference-of-squares/src/lib.rs | 6 ++--- exercises/practice/diffie-hellman/src/lib.rs | 8 +++--- exercises/practice/dominoes/src/lib.rs | 2 +- exercises/practice/dot-dsl/src/lib.rs | 2 +- .../practice/doubly-linked-list/src/lib.rs | 26 +++++++++---------- exercises/practice/etl/src/lib.rs | 2 +- exercises/practice/fizzy/src/lib.rs | 10 +++---- exercises/practice/forth/src/lib.rs | 6 ++--- exercises/practice/gigasecond/src/lib.rs | 2 +- exercises/practice/grade-school/src/lib.rs | 8 +++--- exercises/practice/grains/src/lib.rs | 4 +-- exercises/practice/grep/src/lib.rs | 4 +-- exercises/practice/hamming/src/lib.rs | 2 +- exercises/practice/hexadecimal/src/lib.rs | 2 +- exercises/practice/high-scores/src/lib.rs | 10 +++---- exercises/practice/isbn-verifier/src/lib.rs | 2 +- exercises/practice/isogram/src/lib.rs | 2 +- .../practice/kindergarten-garden/src/lib.rs | 2 +- exercises/practice/knapsack/src/lib.rs | 2 +- .../largest-series-product/src/lib.rs | 2 +- exercises/practice/leap/src/lib.rs | 2 +- exercises/practice/luhn-from/src/lib.rs | 4 +-- exercises/practice/luhn-trait/src/lib.rs | 2 +- exercises/practice/luhn/src/lib.rs | 2 +- exercises/practice/macros/src/lib.rs | 2 +- .../practice/matching-brackets/src/lib.rs | 2 +- exercises/practice/minesweeper/src/lib.rs | 2 +- exercises/practice/nth-prime/src/lib.rs | 2 +- .../practice/nucleotide-codons/src/lib.rs | 6 ++--- .../practice/nucleotide-count/src/lib.rs | 6 ++--- exercises/practice/ocr-numbers/src/lib.rs | 2 +- exercises/practice/paasio/src/lib.rs | 22 ++++++++-------- .../practice/palindrome-products/src/lib.rs | 6 ++--- exercises/practice/pangram/src/lib.rs | 2 +- .../parallel-letter-frequency/src/lib.rs | 2 +- .../practice/pascals-triangle/src/lib.rs | 4 +-- exercises/practice/perfect-numbers/src/lib.rs | 2 +- exercises/practice/phone-number/src/lib.rs | 2 +- exercises/practice/pig-latin/src/lib.rs | 4 +-- exercises/practice/poker/src/lib.rs | 2 +- exercises/practice/prime-factors/src/lib.rs | 2 +- .../practice/protein-translation/src/lib.rs | 8 +++--- exercises/practice/proverb/src/lib.rs | 2 +- .../practice/pythagorean-triplet/src/lib.rs | 2 +- exercises/practice/queen-attack/src/lib.rs | 6 ++--- .../practice/rail-fence-cipher/src/lib.rs | 6 ++--- exercises/practice/raindrops/src/lib.rs | 2 +- exercises/practice/react/src/lib.rs | 14 +++++----- exercises/practice/rectangles/src/lib.rs | 2 +- exercises/practice/reverse-string/src/lib.rs | 2 +- .../practice/rna-transcription/src/lib.rs | 6 ++--- exercises/practice/robot-name/src/lib.rs | 6 ++--- exercises/practice/robot-simulator/src/lib.rs | 14 +++++----- exercises/practice/roman-numerals/src/lib.rs | 4 +-- .../practice/rotational-cipher/src/lib.rs | 2 +- .../practice/run-length-encoding/src/lib.rs | 4 +-- exercises/practice/saddle-points/src/lib.rs | 2 +- exercises/practice/say/src/lib.rs | 2 +- exercises/practice/scale-generator/src/lib.rs | 6 ++--- exercises/practice/scrabble-score/src/lib.rs | 2 +- .../practice/secret-handshake/src/lib.rs | 2 +- exercises/practice/series/src/lib.rs | 2 +- exercises/practice/sieve/src/lib.rs | 2 +- exercises/practice/simple-cipher/src/lib.rs | 8 +++--- .../practice/simple-linked-list/src/lib.rs | 18 ++++++------- exercises/practice/space-age/src/lib.rs | 6 ++--- exercises/practice/spiral-matrix/src/lib.rs | 2 +- exercises/practice/sublist/src/lib.rs | 2 +- .../practice/sum-of-multiples/src/lib.rs | 2 +- exercises/practice/tournament/src/lib.rs | 2 +- exercises/practice/triangle/src/lib.rs | 8 +++--- exercises/practice/two-bucket/src/lib.rs | 2 +- exercises/practice/two-fer/src/lib.rs | 2 +- .../variable-length-quantity/src/lib.rs | 4 +-- exercises/practice/word-count/src/lib.rs | 2 +- exercises/practice/wordy/src/lib.rs | 4 +-- exercises/practice/xorcism/src/lib.rs | 6 ++--- exercises/practice/yacht/src/lib.rs | 2 +- rust-tooling/src/bin/generate_exercise.rs | 4 +-- 116 files changed, 249 insertions(+), 269 deletions(-) diff --git a/concepts/structs/about.md b/concepts/structs/about.md index 061ba5889..41f131212 100644 --- a/concepts/structs/about.md +++ b/concepts/structs/about.md @@ -32,7 +32,7 @@ Lastly, methods can be defined on structs inside of an `impl` block: impl Item { // initializes and returns a new instance of our Item struct fn new() -> Self { - unimplemented!() + todo!() } } ``` diff --git a/exercises/concept/assembly-line/src/lib.rs b/exercises/concept/assembly-line/src/lib.rs index 96e01eda4..3a2a928f6 100644 --- a/exercises/concept/assembly-line/src/lib.rs +++ b/exercises/concept/assembly-line/src/lib.rs @@ -1,7 +1,7 @@ pub fn production_rate_per_hour(speed: u8) -> f64 { - unimplemented!("calculate hourly production rate at speed: {speed}") + todo!("calculate hourly production rate at speed: {speed}") } pub fn working_items_per_minute(speed: u8) -> u32 { - unimplemented!("calculate the amount of working items at speed: {speed}") + todo!("calculate the amount of working items at speed: {speed}") } diff --git a/exercises/concept/csv-builder/src/lib.rs b/exercises/concept/csv-builder/src/lib.rs index ec5887180..4b1f94ff9 100644 --- a/exercises/concept/csv-builder/src/lib.rs +++ b/exercises/concept/csv-builder/src/lib.rs @@ -9,16 +9,16 @@ pub struct CsvRecordBuilder { impl CsvRecordBuilder { // Create a new builder pub fn new() -> Self { - unimplemented!("implement the `CsvRecordBuilder::new` method") + todo!("implement the `CsvRecordBuilder::new` method") } /// Adds an item to the list separated by a space and a comma. pub fn add(&mut self, val: &str) { - unimplemented!("implement the `CsvRecordBuilder::add` method, adding {val}") + todo!("implement the `CsvRecordBuilder::add` method, adding {val}") } /// Consumes the builder and returns the comma separated list pub fn build(self) -> String { - unimplemented!("implement the `CsvRecordBuilder::build` method") + todo!("implement the `CsvRecordBuilder::build` method") } } diff --git a/exercises/concept/health-statistics/.docs/introduction.md b/exercises/concept/health-statistics/.docs/introduction.md index 8894da4aa..4ab3579e9 100644 --- a/exercises/concept/health-statistics/.docs/introduction.md +++ b/exercises/concept/health-statistics/.docs/introduction.md @@ -32,7 +32,7 @@ Lastly, methods can be defined on structs inside of an `impl` block: impl Item { // initializes and returns a new instance of our Item struct fn new() -> Self { - unimplemented!() + todo!() } } ``` diff --git a/exercises/concept/health-statistics/src/lib.rs b/exercises/concept/health-statistics/src/lib.rs index f0e2fa0d7..c38c2b705 100644 --- a/exercises/concept/health-statistics/src/lib.rs +++ b/exercises/concept/health-statistics/src/lib.rs @@ -10,26 +10,26 @@ pub struct User { impl User { pub fn new(name: String, age: u32, weight: f32) -> Self { - unimplemented!() + todo!() } pub fn name(&self) -> &str { - unimplemented!() + todo!() } pub fn age(&self) -> u32 { - unimplemented!() + todo!() } pub fn weight(&self) -> f32 { - unimplemented!() + todo!() } pub fn set_age(&mut self, new_age: u32) { - unimplemented!() + todo!() } pub fn set_weight(&mut self, new_weight: f32) { - unimplemented!() + todo!() } } diff --git a/exercises/concept/low-power-embedded-game/.docs/hints.md b/exercises/concept/low-power-embedded-game/.docs/hints.md index e7317a614..dcf3408c2 100644 --- a/exercises/concept/low-power-embedded-game/.docs/hints.md +++ b/exercises/concept/low-power-embedded-game/.docs/hints.md @@ -18,6 +18,6 @@ ## 3. Implement a `manhattan` method on a `Position` tuple struct -- Don't worry about method syntax; just replacing the `unimplemented` portion within the `impl Position` block will do the right thing. +- Don't worry about method syntax; just replacing the `todo` portion within the `impl Position` block will do the right thing. - Consider that some values within a `Position` may be negative, but a distance is never negative. - Calculating the absolute value is [built-in](https://doc.rust-lang.org/std/primitive.i16.html#method.abs) diff --git a/exercises/concept/low-power-embedded-game/src/lib.rs b/exercises/concept/low-power-embedded-game/src/lib.rs index 48d259d14..917cf7ec8 100644 --- a/exercises/concept/low-power-embedded-game/src/lib.rs +++ b/exercises/concept/low-power-embedded-game/src/lib.rs @@ -3,11 +3,11 @@ #![allow(unused)] pub fn divmod(dividend: i16, divisor: i16) -> (i16, i16) { - unimplemented!("implement `fn divmod`"); + todo!("implement `fn divmod`"); } pub fn evens(iter: impl Iterator) -> impl Iterator { - unimplemented!("implement `fn evens`"); + todo!("implement `fn evens`"); // TODO: remove this; it's only necessary to allow this function to compile // before the student has done any work. std::iter::empty() @@ -16,6 +16,6 @@ pub fn evens(iter: impl Iterator) -> impl Iterator { pub struct Position(pub i16, pub i16); impl Position { pub fn manhattan(&self) -> i16 { - unimplemented!("implement `fn manhattan`") + todo!("implement `fn manhattan`") } } diff --git a/exercises/concept/lucians-luscious-lasagna/src/lib.rs b/exercises/concept/lucians-luscious-lasagna/src/lib.rs index c98729b81..8d2fd2d44 100644 --- a/exercises/concept/lucians-luscious-lasagna/src/lib.rs +++ b/exercises/concept/lucians-luscious-lasagna/src/lib.rs @@ -1,19 +1,19 @@ pub fn expected_minutes_in_oven() -> i32 { - unimplemented!("return expected minutes in the oven") + todo!("return expected minutes in the oven") } pub fn remaining_minutes_in_oven(actual_minutes_in_oven: i32) -> i32 { - unimplemented!( + todo!( "calculate remaining minutes in oven given actual minutes in oven: {actual_minutes_in_oven}" ) } pub fn preparation_time_in_minutes(number_of_layers: i32) -> i32 { - unimplemented!("calculate preparation time in minutes for number of layers: {number_of_layers}") + todo!("calculate preparation time in minutes for number of layers: {number_of_layers}") } pub fn elapsed_time_in_minutes(number_of_layers: i32, actual_minutes_in_oven: i32) -> i32 { - unimplemented!( + todo!( "calculate elapsed time in minutes for number of layers {number_of_layers} and actual minutes in oven {actual_minutes_in_oven}" ) } diff --git a/exercises/concept/magazine-cutout/.docs/instructions.md b/exercises/concept/magazine-cutout/.docs/instructions.md index 8e367d5d0..65433ec4a 100644 --- a/exercises/concept/magazine-cutout/.docs/instructions.md +++ b/exercises/concept/magazine-cutout/.docs/instructions.md @@ -13,7 +13,7 @@ You'll start with the following stubbed function signature: ```rust pub fn can_construct_note(magazine: &[&str], note: &[&str]) -> bool { - unimplemented!() + todo!() } ``` diff --git a/exercises/concept/magazine-cutout/src/lib.rs b/exercises/concept/magazine-cutout/src/lib.rs index eb1876e28..cbe23f634 100644 --- a/exercises/concept/magazine-cutout/src/lib.rs +++ b/exercises/concept/magazine-cutout/src/lib.rs @@ -5,5 +5,5 @@ use std::collections::HashMap; pub fn can_construct_note(magazine: &[&str], note: &[&str]) -> bool { - unimplemented!() + todo!() } diff --git a/exercises/concept/resistor-color/src/lib.rs b/exercises/concept/resistor-color/src/lib.rs index 96a5f1033..ff4c92267 100644 --- a/exercises/concept/resistor-color/src/lib.rs +++ b/exercises/concept/resistor-color/src/lib.rs @@ -13,13 +13,13 @@ pub enum ResistorColor { } pub fn color_to_value(color: ResistorColor) -> u32 { - unimplemented!("convert color {color:?} into a numerical representation") + todo!("convert color {color:?} into a numerical representation") } pub fn value_to_color_string(value: u32) -> String { - unimplemented!("convert the value {value} into a string representation of color") + todo!("convert the value {value} into a string representation of color") } pub fn colors() -> Vec { - unimplemented!("return a list of all the colors ordered by resistance") + todo!("return a list of all the colors ordered by resistance") } diff --git a/exercises/concept/role-playing-game/src/lib.rs b/exercises/concept/role-playing-game/src/lib.rs index effc3d614..1bdc203e1 100644 --- a/exercises/concept/role-playing-game/src/lib.rs +++ b/exercises/concept/role-playing-game/src/lib.rs @@ -6,10 +6,10 @@ pub struct Player { impl Player { pub fn revive(&self) -> Option { - unimplemented!("Revive this player") + todo!("Revive this player") } pub fn cast_spell(&mut self, mana_cost: u32) -> u32 { - unimplemented!("Cast a spell of cost {mana_cost}") + todo!("Cast a spell of cost {mana_cost}") } } diff --git a/exercises/concept/rpn-calculator/.docs/instructions.md b/exercises/concept/rpn-calculator/.docs/instructions.md index a749c9515..b6c58751d 100644 --- a/exercises/concept/rpn-calculator/.docs/instructions.md +++ b/exercises/concept/rpn-calculator/.docs/instructions.md @@ -105,7 +105,7 @@ pub enum CalculatorInput { } pub fn evaluate(inputs: &[CalculatorInput]) -> Option { - unimplemented!( + todo!( "Given the inputs: {inputs:?}, evaluate them as though they were a Reverse Polish notation expression" ); } diff --git a/exercises/concept/rpn-calculator/src/lib.rs b/exercises/concept/rpn-calculator/src/lib.rs index 0e0011f66..f740777eb 100644 --- a/exercises/concept/rpn-calculator/src/lib.rs +++ b/exercises/concept/rpn-calculator/src/lib.rs @@ -8,7 +8,7 @@ pub enum CalculatorInput { } pub fn evaluate(inputs: &[CalculatorInput]) -> Option { - unimplemented!( + todo!( "Given the inputs: {inputs:?}, evaluate them as though they were a Reverse Polish notation expression" ); } diff --git a/exercises/concept/semi-structured-logs/src/lib.rs b/exercises/concept/semi-structured-logs/src/lib.rs index 91b0560f1..07916f96e 100644 --- a/exercises/concept/semi-structured-logs/src/lib.rs +++ b/exercises/concept/semi-structured-logs/src/lib.rs @@ -11,14 +11,14 @@ pub enum LogLevel { } /// primary function for emitting logs pub fn log(level: LogLevel, message: &str) -> String { - unimplemented!("return a message for the given log level") + todo!("return a message for the given log level") } pub fn info(message: &str) -> String { - unimplemented!("return a message for info log level") + todo!("return a message for info log level") } pub fn warn(message: &str) -> String { - unimplemented!("return a message for warn log level") + todo!("return a message for warn log level") } pub fn error(message: &str) -> String { - unimplemented!("return a message for error log level") + todo!("return a message for error log level") } diff --git a/exercises/concept/short-fibonacci/src/lib.rs b/exercises/concept/short-fibonacci/src/lib.rs index 2d5dcbc5c..0db5a8feb 100644 --- a/exercises/concept/short-fibonacci/src/lib.rs +++ b/exercises/concept/short-fibonacci/src/lib.rs @@ -1,13 +1,13 @@ /// Create an empty vector pub fn create_empty() -> Vec { - unimplemented!() + todo!() } /// Create a buffer of `count` zeroes. /// /// Applications often use buffers when serializing data to send over the network. pub fn create_buffer(count: usize) -> Vec { - unimplemented!("create a zeroized buffer of {count} bytes") + todo!("create a zeroized buffer of {count} bytes") } /// Create a vector containing the first five elements of the Fibonacci sequence. @@ -15,5 +15,5 @@ pub fn create_buffer(count: usize) -> Vec { /// Fibonacci's sequence is the list of numbers where the next number is a sum of the previous two. /// Its first five elements are `1, 1, 2, 3, 5`. pub fn fibonacci() -> Vec { - unimplemented!() + todo!() } diff --git a/exercises/practice/accumulate/src/lib.rs b/exercises/practice/accumulate/src/lib.rs index bdacbd272..2ed0e9e22 100644 --- a/exercises/practice/accumulate/src/lib.rs +++ b/exercises/practice/accumulate/src/lib.rs @@ -1,4 +1,4 @@ /// What should the type of _function be? pub fn map(input: Vec, _function: ???) -> Vec { - unimplemented!("Transform input vector {input:?} using passed function"); + todo!("Transform input vector {input:?} using passed function"); } diff --git a/exercises/practice/acronym/src/lib.rs b/exercises/practice/acronym/src/lib.rs index fd1c026a3..d31dd96c2 100644 --- a/exercises/practice/acronym/src/lib.rs +++ b/exercises/practice/acronym/src/lib.rs @@ -1,3 +1,3 @@ pub fn abbreviate(phrase: &str) -> String { - unimplemented!("Given the phrase '{phrase}', return its acronym"); + todo!("Given the phrase '{phrase}', return its acronym"); } diff --git a/exercises/practice/affine-cipher/src/lib.rs b/exercises/practice/affine-cipher/src/lib.rs index 8e666711f..396aa99d0 100644 --- a/exercises/practice/affine-cipher/src/lib.rs +++ b/exercises/practice/affine-cipher/src/lib.rs @@ -8,11 +8,11 @@ pub enum AffineCipherError { /// Encodes the plaintext using the affine cipher with key (`a`, `b`). Note that, rather than /// returning a return code, the more common convention in Rust is to return a `Result`. pub fn encode(plaintext: &str, a: i32, b: i32) -> Result { - unimplemented!("Encode {plaintext} with the key ({a}, {b})"); + todo!("Encode {plaintext} with the key ({a}, {b})"); } /// Decodes the ciphertext using the affine cipher with key (`a`, `b`). Note that, rather than /// returning a return code, the more common convention in Rust is to return a `Result`. pub fn decode(ciphertext: &str, a: i32, b: i32) -> Result { - unimplemented!("Decode {ciphertext} with the key ({a}, {b})"); + todo!("Decode {ciphertext} with the key ({a}, {b})"); } diff --git a/exercises/practice/all-your-base/src/lib.rs b/exercises/practice/all-your-base/src/lib.rs index fd9996b9d..ce88f6698 100644 --- a/exercises/practice/all-your-base/src/lib.rs +++ b/exercises/practice/all-your-base/src/lib.rs @@ -37,5 +37,5 @@ pub enum Error { /// However, your function must be able to process input with leading 0 digits. /// pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result, Error> { - unimplemented!("Convert {number:?} from base {from_base} to base {to_base}") + todo!("Convert {number:?} from base {from_base} to base {to_base}") } diff --git a/exercises/practice/allergies/src/lib.rs b/exercises/practice/allergies/src/lib.rs index a3715f409..a2fd3088f 100644 --- a/exercises/practice/allergies/src/lib.rs +++ b/exercises/practice/allergies/src/lib.rs @@ -14,14 +14,14 @@ pub enum Allergen { impl Allergies { pub fn new(score: u32) -> Self { - unimplemented!("Given the '{score}' score, construct a new Allergies struct."); + todo!("Given the '{score}' score, construct a new Allergies struct."); } pub fn is_allergic_to(&self, allergen: &Allergen) -> bool { - unimplemented!("Determine if the patient is allergic to the '{allergen:?}' allergen."); + todo!("Determine if the patient is allergic to the '{allergen:?}' allergen."); } pub fn allergies(&self) -> Vec { - unimplemented!("Return the list of allergens contained within the score with which the Allergies struct was made."); + todo!("Return the list of allergens contained within the score with which the Allergies struct was made."); } } diff --git a/exercises/practice/alphametics/src/lib.rs b/exercises/practice/alphametics/src/lib.rs index d5cb54146..a7eb2c2e2 100644 --- a/exercises/practice/alphametics/src/lib.rs +++ b/exercises/practice/alphametics/src/lib.rs @@ -1,5 +1,5 @@ use std::collections::HashMap; pub fn solve(input: &str) -> Option> { - unimplemented!("Solve the alphametic {input:?}") + todo!("Solve the alphametic {input:?}") } diff --git a/exercises/practice/anagram/src/lib.rs b/exercises/practice/anagram/src/lib.rs index 111521663..f029d0449 100644 --- a/exercises/practice/anagram/src/lib.rs +++ b/exercises/practice/anagram/src/lib.rs @@ -1,7 +1,5 @@ use std::collections::HashSet; pub fn anagrams_for<'a>(word: &str, possible_anagrams: &[&str]) -> HashSet<&'a str> { - unimplemented!( - "For the '{word}' word find anagrams among the following words: {possible_anagrams:?}" - ); + todo!("For the '{word}' word find anagrams among the following words: {possible_anagrams:?}"); } diff --git a/exercises/practice/armstrong-numbers/src/lib.rs b/exercises/practice/armstrong-numbers/src/lib.rs index 3830a8484..91a62532d 100644 --- a/exercises/practice/armstrong-numbers/src/lib.rs +++ b/exercises/practice/armstrong-numbers/src/lib.rs @@ -1,3 +1,3 @@ pub fn is_armstrong_number(num: u32) -> bool { - unimplemented!("true if {num} is an armstrong number") + todo!("true if {num} is an armstrong number") } diff --git a/exercises/practice/atbash-cipher/src/lib.rs b/exercises/practice/atbash-cipher/src/lib.rs index 17e480ae5..5f63c8b85 100644 --- a/exercises/practice/atbash-cipher/src/lib.rs +++ b/exercises/practice/atbash-cipher/src/lib.rs @@ -1,9 +1,9 @@ /// "Encipher" with the Atbash cipher. pub fn encode(plain: &str) -> String { - unimplemented!("Encoding of {plain:?} in Atbash cipher."); + todo!("Encoding of {plain:?} in Atbash cipher."); } /// "Decipher" with the Atbash cipher. pub fn decode(cipher: &str) -> String { - unimplemented!("Decoding of {cipher:?} in Atbash cipher."); + todo!("Decoding of {cipher:?} in Atbash cipher."); } diff --git a/exercises/practice/beer-song/src/lib.rs b/exercises/practice/beer-song/src/lib.rs index c35a613c2..fd6334416 100644 --- a/exercises/practice/beer-song/src/lib.rs +++ b/exercises/practice/beer-song/src/lib.rs @@ -1,7 +1,7 @@ pub fn verse(n: u32) -> String { - unimplemented!("emit verse {n}") + todo!("emit verse {n}") } pub fn sing(start: u32, end: u32) -> String { - unimplemented!("sing verses {start} to {end}, inclusive") + todo!("sing verses {start} to {end}, inclusive") } diff --git a/exercises/practice/binary-search/src/lib.rs b/exercises/practice/binary-search/src/lib.rs index 5b10dadac..fbdd6d6fd 100644 --- a/exercises/practice/binary-search/src/lib.rs +++ b/exercises/practice/binary-search/src/lib.rs @@ -1,5 +1,5 @@ pub fn find(array: &[i32], key: i32) -> Option { - unimplemented!( + todo!( "Using the binary search algorithm, find the element '{key}' in the array '{array:?}' and return its index." ); } diff --git a/exercises/practice/bob/src/lib.rs b/exercises/practice/bob/src/lib.rs index 30b51cbcf..833f2dfca 100644 --- a/exercises/practice/bob/src/lib.rs +++ b/exercises/practice/bob/src/lib.rs @@ -1,3 +1,3 @@ pub fn reply(message: &str) -> &str { - unimplemented!("have Bob reply to the incoming message: {message}") + todo!("have Bob reply to the incoming message: {message}") } diff --git a/exercises/practice/book-store/src/lib.rs b/exercises/practice/book-store/src/lib.rs index c8cf0232a..64ee8dd31 100644 --- a/exercises/practice/book-store/src/lib.rs +++ b/exercises/practice/book-store/src/lib.rs @@ -1,3 +1,3 @@ pub fn lowest_price(books: &[u32]) -> u32 { - unimplemented!("Find the lowest price of the bookbasket with books {books:?}") + todo!("Find the lowest price of the bookbasket with books {books:?}") } diff --git a/exercises/practice/bowling/src/lib.rs b/exercises/practice/bowling/src/lib.rs index 3b46f51b8..3163e6120 100644 --- a/exercises/practice/bowling/src/lib.rs +++ b/exercises/practice/bowling/src/lib.rs @@ -8,14 +8,14 @@ pub struct BowlingGame {} impl BowlingGame { pub fn new() -> Self { - unimplemented!(); + todo!(); } pub fn roll(&mut self, pins: u16) -> Result<(), Error> { - unimplemented!("Record that {pins} pins have been scored"); + todo!("Record that {pins} pins have been scored"); } pub fn score(&self) -> Option { - unimplemented!("Return the score if the game is complete, or None if not."); + todo!("Return the score if the game is complete, or None if not."); } } diff --git a/exercises/practice/circular-buffer/src/lib.rs b/exercises/practice/circular-buffer/src/lib.rs index 426fba8a3..63686c805 100644 --- a/exercises/practice/circular-buffer/src/lib.rs +++ b/exercises/practice/circular-buffer/src/lib.rs @@ -12,7 +12,7 @@ pub enum Error { impl CircularBuffer { pub fn new(capacity: usize) -> Self { - unimplemented!( + todo!( "Construct a new CircularBuffer with the capacity to hold {}.", match capacity { 1 => "1 element".to_string(), @@ -22,18 +22,18 @@ impl CircularBuffer { } pub fn write(&mut self, _element: T) -> Result<(), Error> { - unimplemented!("Write the passed element to the CircularBuffer or return FullBuffer error if CircularBuffer is full."); + todo!("Write the passed element to the CircularBuffer or return FullBuffer error if CircularBuffer is full."); } pub fn read(&mut self) -> Result { - unimplemented!("Read the oldest element from the CircularBuffer or return EmptyBuffer error if CircularBuffer is empty."); + todo!("Read the oldest element from the CircularBuffer or return EmptyBuffer error if CircularBuffer is empty."); } pub fn clear(&mut self) { - unimplemented!("Clear the CircularBuffer."); + todo!("Clear the CircularBuffer."); } pub fn overwrite(&mut self, _element: T) { - unimplemented!("Write the passed element to the CircularBuffer, overwriting the existing elements if CircularBuffer is full."); + todo!("Write the passed element to the CircularBuffer, overwriting the existing elements if CircularBuffer is full."); } } diff --git a/exercises/practice/clock/src/lib.rs b/exercises/practice/clock/src/lib.rs index 8627e2296..c625f73de 100644 --- a/exercises/practice/clock/src/lib.rs +++ b/exercises/practice/clock/src/lib.rs @@ -2,10 +2,10 @@ pub struct Clock; impl Clock { pub fn new(hours: i32, minutes: i32) -> Self { - unimplemented!("Construct a new Clock from {hours} hours and {minutes} minutes"); + todo!("Construct a new Clock from {hours} hours and {minutes} minutes"); } pub fn add_minutes(&self, minutes: i32) -> Self { - unimplemented!("Add {minutes} minutes to existing Clock time"); + todo!("Add {minutes} minutes to existing Clock time"); } } diff --git a/exercises/practice/collatz-conjecture/src/lib.rs b/exercises/practice/collatz-conjecture/src/lib.rs index 5bf41a567..84f178225 100644 --- a/exercises/practice/collatz-conjecture/src/lib.rs +++ b/exercises/practice/collatz-conjecture/src/lib.rs @@ -1,5 +1,3 @@ pub fn collatz(n: u64) -> Option { - unimplemented!( - "return Some(x) where x is the number of steps required to reach 1 starting with {n}" - ) + todo!("return Some(x) where x is the number of steps required to reach 1 starting with {n}") } diff --git a/exercises/practice/crypto-square/src/lib.rs b/exercises/practice/crypto-square/src/lib.rs index d9700db5c..c22623ef2 100644 --- a/exercises/practice/crypto-square/src/lib.rs +++ b/exercises/practice/crypto-square/src/lib.rs @@ -1,3 +1,3 @@ pub fn encrypt(input: &str) -> String { - unimplemented!("Encrypt {input:?} using a square code") + todo!("Encrypt {input:?} using a square code") } diff --git a/exercises/practice/custom-set/src/lib.rs b/exercises/practice/custom-set/src/lib.rs index f5ff8f44c..3cde4569c 100644 --- a/exercises/practice/custom-set/src/lib.rs +++ b/exercises/practice/custom-set/src/lib.rs @@ -7,41 +7,41 @@ pub struct CustomSet { impl CustomSet { pub fn new(_input: &[T]) -> Self { - unimplemented!(); + todo!(); } pub fn contains(&self, _element: &T) -> bool { - unimplemented!(); + todo!(); } pub fn add(&mut self, _element: T) { - unimplemented!(); + todo!(); } pub fn is_subset(&self, _other: &Self) -> bool { - unimplemented!(); + todo!(); } pub fn is_empty(&self) -> bool { - unimplemented!(); + todo!(); } pub fn is_disjoint(&self, _other: &Self) -> bool { - unimplemented!(); + todo!(); } #[must_use] pub fn intersection(&self, _other: &Self) -> Self { - unimplemented!(); + todo!(); } #[must_use] pub fn difference(&self, _other: &Self) -> Self { - unimplemented!(); + todo!(); } #[must_use] pub fn union(&self, _other: &Self) -> Self { - unimplemented!(); + todo!(); } } diff --git a/exercises/practice/decimal/src/lib.rs b/exercises/practice/decimal/src/lib.rs index e61d55bb5..c9ad7098f 100644 --- a/exercises/practice/decimal/src/lib.rs +++ b/exercises/practice/decimal/src/lib.rs @@ -5,6 +5,6 @@ pub struct Decimal { impl Decimal { pub fn try_from(input: &str) -> Option { - unimplemented!("Create a new decimal with a value of {input}") + todo!("Create a new decimal with a value of {input}") } } diff --git a/exercises/practice/diamond/src/lib.rs b/exercises/practice/diamond/src/lib.rs index 0bcc23a32..db78003f8 100644 --- a/exercises/practice/diamond/src/lib.rs +++ b/exercises/practice/diamond/src/lib.rs @@ -1,5 +1,3 @@ pub fn get_diamond(c: char) -> Vec { - unimplemented!( - "Return the vector of strings which represent the diamond with particular char {c}" - ); + todo!("Return the vector of strings which represent the diamond with particular char {c}"); } diff --git a/exercises/practice/difference-of-squares/src/lib.rs b/exercises/practice/difference-of-squares/src/lib.rs index 402286a6c..fdf2e93d8 100644 --- a/exercises/practice/difference-of-squares/src/lib.rs +++ b/exercises/practice/difference-of-squares/src/lib.rs @@ -1,11 +1,11 @@ pub fn square_of_sum(n: u32) -> u32 { - unimplemented!("square of sum of 1...{n}") + todo!("square of sum of 1...{n}") } pub fn sum_of_squares(n: u32) -> u32 { - unimplemented!("sum of squares of 1...{n}") + todo!("sum of squares of 1...{n}") } pub fn difference(n: u32) -> u32 { - unimplemented!("difference between square of sum of 1...{n} and sum of squares of 1...{n}") + todo!("difference between square of sum of 1...{n} and sum of squares of 1...{n}") } diff --git a/exercises/practice/diffie-hellman/src/lib.rs b/exercises/practice/diffie-hellman/src/lib.rs index a38954435..157e540d7 100644 --- a/exercises/practice/diffie-hellman/src/lib.rs +++ b/exercises/practice/diffie-hellman/src/lib.rs @@ -1,13 +1,11 @@ pub fn private_key(p: u64) -> u64 { - unimplemented!("Pick a private key greater than 1 and less than {p}") + todo!("Pick a private key greater than 1 and less than {p}") } pub fn public_key(p: u64, g: u64, a: u64) -> u64 { - unimplemented!("Calculate public key using prime numbers {p} and {g}, and private key {a}") + todo!("Calculate public key using prime numbers {p} and {g}, and private key {a}") } pub fn secret(p: u64, b_pub: u64, a: u64) -> u64 { - unimplemented!( - "Calculate secret key using prime number {p}, public key {b_pub}, and private key {a}" - ) + todo!("Calculate secret key using prime number {p}, public key {b_pub}, and private key {a}") } diff --git a/exercises/practice/dominoes/src/lib.rs b/exercises/practice/dominoes/src/lib.rs index 7591c7ab9..3137bddc7 100644 --- a/exercises/practice/dominoes/src/lib.rs +++ b/exercises/practice/dominoes/src/lib.rs @@ -1,3 +1,3 @@ pub fn chain(input: &[(u8, u8)]) -> Option> { - unimplemented!("From the given input '{input:?}' construct a proper dominoes chain or return None if it is not possible."); + todo!("From the given input '{input:?}' construct a proper dominoes chain or return None if it is not possible."); } diff --git a/exercises/practice/dot-dsl/src/lib.rs b/exercises/practice/dot-dsl/src/lib.rs index ace9a0e88..3f2514dc6 100644 --- a/exercises/practice/dot-dsl/src/lib.rs +++ b/exercises/practice/dot-dsl/src/lib.rs @@ -3,7 +3,7 @@ pub mod graph { impl Graph { pub fn new() -> Self { - unimplemented!("Construct a new Graph struct."); + todo!("Construct a new Graph struct."); } } } diff --git a/exercises/practice/doubly-linked-list/src/lib.rs b/exercises/practice/doubly-linked-list/src/lib.rs index d6391c6f3..a02fdb3f9 100644 --- a/exercises/practice/doubly-linked-list/src/lib.rs +++ b/exercises/practice/doubly-linked-list/src/lib.rs @@ -11,7 +11,7 @@ pub struct Iter<'a, T>(std::marker::PhantomData<&'a T>); impl LinkedList { pub fn new() -> Self { - unimplemented!() + todo!() } // You may be wondering why it's necessary to have is_empty() @@ -20,26 +20,26 @@ impl LinkedList { // whereas is_empty() is almost always cheap. // (Also ask yourself whether len() is expensive for LinkedList) pub fn is_empty(&self) -> bool { - unimplemented!() + todo!() } pub fn len(&self) -> usize { - unimplemented!() + todo!() } /// Return a cursor positioned on the front element pub fn cursor_front(&mut self) -> Cursor<'_, T> { - unimplemented!() + todo!() } /// Return a cursor positioned on the back element pub fn cursor_back(&mut self) -> Cursor<'_, T> { - unimplemented!() + todo!() } /// Return an iterator that moves from front to back pub fn iter(&self) -> Iter<'_, T> { - unimplemented!() + todo!() } } @@ -48,35 +48,35 @@ impl LinkedList { impl Cursor<'_, T> { /// Take a mutable reference to the current element pub fn peek_mut(&mut self) -> Option<&mut T> { - unimplemented!() + todo!() } /// Move one position forward (towards the back) and /// return a reference to the new position #[allow(clippy::should_implement_trait)] pub fn next(&mut self) -> Option<&mut T> { - unimplemented!() + todo!() } /// Move one position backward (towards the front) and /// return a reference to the new position pub fn prev(&mut self) -> Option<&mut T> { - unimplemented!() + todo!() } /// Remove and return the element at the current position and move the cursor /// to the neighboring element that's closest to the back. This can be /// either the next or previous position. pub fn take(&mut self) -> Option { - unimplemented!() + todo!() } pub fn insert_after(&mut self, _element: T) { - unimplemented!() + todo!() } pub fn insert_before(&mut self, _element: T) { - unimplemented!() + todo!() } } @@ -84,6 +84,6 @@ impl<'a, T> Iterator for Iter<'a, T> { type Item = &'a T; fn next(&mut self) -> Option<&'a T> { - unimplemented!() + todo!() } } diff --git a/exercises/practice/etl/src/lib.rs b/exercises/practice/etl/src/lib.rs index 3b451f1c1..25e941f27 100644 --- a/exercises/practice/etl/src/lib.rs +++ b/exercises/practice/etl/src/lib.rs @@ -1,5 +1,5 @@ use std::collections::BTreeMap; pub fn transform(h: &BTreeMap>) -> BTreeMap { - unimplemented!("How will you transform the tree {h:?}?") + todo!("How will you transform the tree {h:?}?") } diff --git a/exercises/practice/fizzy/src/lib.rs b/exercises/practice/fizzy/src/lib.rs index 89d0e802b..03b50ae73 100644 --- a/exercises/practice/fizzy/src/lib.rs +++ b/exercises/practice/fizzy/src/lib.rs @@ -7,7 +7,7 @@ pub struct Matcher(std::marker::PhantomData); impl Matcher { pub fn new(_matcher: F, _subs: S) -> Matcher { - unimplemented!() + todo!() } } @@ -24,18 +24,18 @@ pub struct Fizzy(std::marker::PhantomData); impl Fizzy { pub fn new() -> Self { - unimplemented!() + todo!() } // feel free to change the signature to `mut self` if you like #[must_use] pub fn add_matcher(self, _matcher: Matcher) -> Self { - unimplemented!() + todo!() } /// map this fizzy onto every element of an iterator, returning a new iterator pub fn apply(self, _iter: I) -> impl Iterator { - // unimplemented!() doesn't actually work, here; () is not an Iterator + // todo!() doesn't actually work, here; () is not an Iterator // that said, this is probably not the actual implementation you desire Vec::new().into_iter() } @@ -43,5 +43,5 @@ impl Fizzy { /// convenience function: return a Fizzy which applies the standard fizz-buzz rules pub fn fizz_buzz() -> Fizzy { - unimplemented!() + todo!() } diff --git a/exercises/practice/forth/src/lib.rs b/exercises/practice/forth/src/lib.rs index 16947dd9c..e0e06c73f 100644 --- a/exercises/practice/forth/src/lib.rs +++ b/exercises/practice/forth/src/lib.rs @@ -13,14 +13,14 @@ pub enum Error { impl Forth { pub fn new() -> Forth { - unimplemented!() + todo!() } pub fn stack(&self) -> &[Value] { - unimplemented!() + todo!() } pub fn eval(&mut self, input: &str) -> Result { - unimplemented!("result of evaluating '{input}'") + todo!("result of evaluating '{input}'") } } diff --git a/exercises/practice/gigasecond/src/lib.rs b/exercises/practice/gigasecond/src/lib.rs index 91daf88f5..2dbb9ab9a 100644 --- a/exercises/practice/gigasecond/src/lib.rs +++ b/exercises/practice/gigasecond/src/lib.rs @@ -2,5 +2,5 @@ use time::PrimitiveDateTime as DateTime; // Returns a DateTime one billion seconds after start. pub fn after(start: DateTime) -> DateTime { - unimplemented!("What time is a gigasecond later than {start}"); + todo!("What time is a gigasecond later than {start}"); } diff --git a/exercises/practice/grade-school/src/lib.rs b/exercises/practice/grade-school/src/lib.rs index b81e9a1ab..f90a271c1 100644 --- a/exercises/practice/grade-school/src/lib.rs +++ b/exercises/practice/grade-school/src/lib.rs @@ -9,15 +9,15 @@ pub struct School {} impl School { pub fn new() -> School { - unimplemented!() + todo!() } pub fn add(&mut self, grade: u32, student: &str) { - unimplemented!("Add {student} to the roster for {grade}") + todo!("Add {student} to the roster for {grade}") } pub fn grades(&self) -> Vec { - unimplemented!() + todo!() } // If `grade` returned a reference, `School` would be forced to keep a `Vec` @@ -25,6 +25,6 @@ impl School { // the internal structure can be completely arbitrary. The tradeoff is that some data // must be copied each time `grade` is called. pub fn grade(&self, grade: u32) -> Vec { - unimplemented!("Return the list of students in {grade}") + todo!("Return the list of students in {grade}") } } diff --git a/exercises/practice/grains/src/lib.rs b/exercises/practice/grains/src/lib.rs index a4e1da66d..8eeccb68b 100644 --- a/exercises/practice/grains/src/lib.rs +++ b/exercises/practice/grains/src/lib.rs @@ -1,7 +1,7 @@ pub fn square(s: u32) -> u64 { - unimplemented!("grains of rice on square {s}"); + todo!("grains of rice on square {s}"); } pub fn total() -> u64 { - unimplemented!(); + todo!(); } diff --git a/exercises/practice/grep/src/lib.rs b/exercises/practice/grep/src/lib.rs index 25b636a1e..9ef2c9d22 100644 --- a/exercises/practice/grep/src/lib.rs +++ b/exercises/practice/grep/src/lib.rs @@ -17,14 +17,14 @@ pub struct Flags; impl Flags { pub fn new(flags: &[&str]) -> Self { - unimplemented!( + todo!( "Given the flags {flags:?} implement your own 'Flags' struct to handle flags-related logic" ); } } pub fn grep(pattern: &str, flags: &Flags, files: &[&str]) -> Result, Error> { - unimplemented!( + todo!( "Search the files '{files:?}' for '{pattern}' pattern and save the matches in a vector. Your search logic should be aware of the given flags '{flags:?}'" ); } diff --git a/exercises/practice/hamming/src/lib.rs b/exercises/practice/hamming/src/lib.rs index 021efd9bc..391af3c52 100644 --- a/exercises/practice/hamming/src/lib.rs +++ b/exercises/practice/hamming/src/lib.rs @@ -1,5 +1,5 @@ /// Return the Hamming distance between the strings, /// or None if the lengths are mismatched. pub fn hamming_distance(s1: &str, s2: &str) -> Option { - unimplemented!("What is the Hamming Distance between {s1} and {s2}"); + todo!("What is the Hamming Distance between {s1} and {s2}"); } diff --git a/exercises/practice/hexadecimal/src/lib.rs b/exercises/practice/hexadecimal/src/lib.rs index 17fd514a1..870cc6e56 100644 --- a/exercises/practice/hexadecimal/src/lib.rs +++ b/exercises/practice/hexadecimal/src/lib.rs @@ -2,7 +2,7 @@ // Consider working on all-your-base instead. pub fn hex_to_int(string: &str) -> Option { - unimplemented!( + todo!( "what integer is represented by the base-16 digits {}?", string ); diff --git a/exercises/practice/high-scores/src/lib.rs b/exercises/practice/high-scores/src/lib.rs index ccb33d324..07f513ef6 100644 --- a/exercises/practice/high-scores/src/lib.rs +++ b/exercises/practice/high-scores/src/lib.rs @@ -3,22 +3,22 @@ pub struct HighScores; impl HighScores { pub fn new(scores: &[u32]) -> Self { - unimplemented!("Construct a HighScores struct, given the scores: {scores:?}") + todo!("Construct a HighScores struct, given the scores: {scores:?}") } pub fn scores(&self) -> &[u32] { - unimplemented!("Return all the scores as a slice") + todo!("Return all the scores as a slice") } pub fn latest(&self) -> Option { - unimplemented!("Return the latest (last) score") + todo!("Return the latest (last) score") } pub fn personal_best(&self) -> Option { - unimplemented!("Return the highest score") + todo!("Return the highest score") } pub fn personal_top_three(&self) -> Vec { - unimplemented!("Return 3 highest scores") + todo!("Return 3 highest scores") } } diff --git a/exercises/practice/isbn-verifier/src/lib.rs b/exercises/practice/isbn-verifier/src/lib.rs index e96ca32f4..c500b0bf5 100644 --- a/exercises/practice/isbn-verifier/src/lib.rs +++ b/exercises/practice/isbn-verifier/src/lib.rs @@ -1,4 +1,4 @@ /// Determines whether the supplied string is a valid ISBN number pub fn is_valid_isbn(isbn: &str) -> bool { - unimplemented!("Is {isbn:?} a valid ISBN number?"); + todo!("Is {isbn:?} a valid ISBN number?"); } diff --git a/exercises/practice/isogram/src/lib.rs b/exercises/practice/isogram/src/lib.rs index 7fd132af7..620281037 100644 --- a/exercises/practice/isogram/src/lib.rs +++ b/exercises/practice/isogram/src/lib.rs @@ -1,3 +1,3 @@ pub fn check(candidate: &str) -> bool { - unimplemented!("Is {candidate} an isogram?"); + todo!("Is {candidate} an isogram?"); } diff --git a/exercises/practice/kindergarten-garden/src/lib.rs b/exercises/practice/kindergarten-garden/src/lib.rs index 2c9fd777d..a8eae0480 100644 --- a/exercises/practice/kindergarten-garden/src/lib.rs +++ b/exercises/practice/kindergarten-garden/src/lib.rs @@ -1,3 +1,3 @@ pub fn plants(_diagram: &str, _student: &str) -> Vec<&'static str> { - unimplemented!("Solve kindergarten-garden exercise"); + todo!("Solve kindergarten-garden exercise"); } diff --git a/exercises/practice/knapsack/src/lib.rs b/exercises/practice/knapsack/src/lib.rs index 6f156ccbf..657f37c03 100644 --- a/exercises/practice/knapsack/src/lib.rs +++ b/exercises/practice/knapsack/src/lib.rs @@ -4,5 +4,5 @@ pub struct Item { } pub fn maximum_value(_max_weight: u32, _items: &[Item]) -> u32 { - unimplemented!("Solve the knapsack exercise"); + todo!("Solve the knapsack exercise"); } diff --git a/exercises/practice/largest-series-product/src/lib.rs b/exercises/practice/largest-series-product/src/lib.rs index 2741a299b..8b4ce6d73 100644 --- a/exercises/practice/largest-series-product/src/lib.rs +++ b/exercises/practice/largest-series-product/src/lib.rs @@ -5,5 +5,5 @@ pub enum Error { } pub fn lsp(string_digits: &str, span: usize) -> Result { - unimplemented!("largest series product of a span of {span} digits in {string_digits}"); + todo!("largest series product of a span of {span} digits in {string_digits}"); } diff --git a/exercises/practice/leap/src/lib.rs b/exercises/practice/leap/src/lib.rs index 78a67219a..edeefea4d 100644 --- a/exercises/practice/leap/src/lib.rs +++ b/exercises/practice/leap/src/lib.rs @@ -1,3 +1,3 @@ pub fn is_leap_year(year: u64) -> bool { - unimplemented!("true if {year} is a leap year") + todo!("true if {year} is a leap year") } diff --git a/exercises/practice/luhn-from/src/lib.rs b/exercises/practice/luhn-from/src/lib.rs index c0ca85945..f7c991220 100644 --- a/exercises/practice/luhn-from/src/lib.rs +++ b/exercises/practice/luhn-from/src/lib.rs @@ -2,7 +2,7 @@ pub struct Luhn; impl Luhn { pub fn is_valid(&self) -> bool { - unimplemented!("Determine if the current Luhn struct contains a valid credit card number."); + todo!("Determine if the current Luhn struct contains a valid credit card number."); } } @@ -13,6 +13,6 @@ impl Luhn { /// Perhaps there exists a better solution for this problem? impl<'a> From<&'a str> for Luhn { fn from(input: &'a str) -> Self { - unimplemented!("From the given input '{input}' create a new Luhn struct."); + todo!("From the given input '{input}' create a new Luhn struct."); } } diff --git a/exercises/practice/luhn-trait/src/lib.rs b/exercises/practice/luhn-trait/src/lib.rs index a7aa54218..6b958fecf 100644 --- a/exercises/practice/luhn-trait/src/lib.rs +++ b/exercises/practice/luhn-trait/src/lib.rs @@ -9,6 +9,6 @@ pub trait Luhn { /// Perhaps there exists a better solution for this problem? impl<'a> Luhn for &'a str { fn valid_luhn(&self) -> bool { - unimplemented!("Determine if '{self}' is a valid credit card number."); + todo!("Determine if '{self}' is a valid credit card number."); } } diff --git a/exercises/practice/luhn/src/lib.rs b/exercises/practice/luhn/src/lib.rs index 858a086e6..38e363f13 100644 --- a/exercises/practice/luhn/src/lib.rs +++ b/exercises/practice/luhn/src/lib.rs @@ -1,4 +1,4 @@ /// Check a Luhn checksum. pub fn is_valid(code: &str) -> bool { - unimplemented!("Is the Luhn checksum for {code} valid?"); + todo!("Is the Luhn checksum for {code} valid?"); } diff --git a/exercises/practice/macros/src/lib.rs b/exercises/practice/macros/src/lib.rs index bf7d88812..a4c8c16dc 100644 --- a/exercises/practice/macros/src/lib.rs +++ b/exercises/practice/macros/src/lib.rs @@ -1,6 +1,6 @@ #[macro_export] macro_rules! hashmap { () => { - unimplemented!() + todo!() }; } diff --git a/exercises/practice/matching-brackets/src/lib.rs b/exercises/practice/matching-brackets/src/lib.rs index a780fad56..2adc73149 100644 --- a/exercises/practice/matching-brackets/src/lib.rs +++ b/exercises/practice/matching-brackets/src/lib.rs @@ -1,3 +1,3 @@ pub fn brackets_are_balanced(string: &str) -> bool { - unimplemented!("Check if the string \"{string}\" contains balanced brackets"); + todo!("Check if the string \"{string}\" contains balanced brackets"); } diff --git a/exercises/practice/minesweeper/src/lib.rs b/exercises/practice/minesweeper/src/lib.rs index 3226570b0..55f516ca5 100644 --- a/exercises/practice/minesweeper/src/lib.rs +++ b/exercises/practice/minesweeper/src/lib.rs @@ -1,3 +1,3 @@ pub fn annotate(minefield: &[&str]) -> Vec { - unimplemented!("\nAnnotate each square of the given minefield with the number of mines that surround said square (blank if there are no surrounding mines):\n{minefield:#?}\n"); + todo!("\nAnnotate each square of the given minefield with the number of mines that surround said square (blank if there are no surrounding mines):\n{minefield:#?}\n"); } diff --git a/exercises/practice/nth-prime/src/lib.rs b/exercises/practice/nth-prime/src/lib.rs index f4726d180..563e947cf 100644 --- a/exercises/practice/nth-prime/src/lib.rs +++ b/exercises/practice/nth-prime/src/lib.rs @@ -1,3 +1,3 @@ pub fn nth(n: u32) -> u32 { - unimplemented!("What is the 0-indexed {n}th prime number?") + todo!("What is the 0-indexed {n}th prime number?") } diff --git a/exercises/practice/nucleotide-codons/src/lib.rs b/exercises/practice/nucleotide-codons/src/lib.rs index f76ce4a97..17a6829b3 100644 --- a/exercises/practice/nucleotide-codons/src/lib.rs +++ b/exercises/practice/nucleotide-codons/src/lib.rs @@ -16,19 +16,19 @@ pub struct Error; impl<'a> CodonsInfo<'a> { pub fn name_for(&self, codon: &str) -> Result<&'a str, Error> { - unimplemented!( + todo!( "Return the protein name for a '{}' codon or Err, if codon string is invalid", codon ); } pub fn of_rna(&self, rna: &str) -> Result, Error> { - unimplemented!("Return a list of protein names that correspond to the '{}' RNA string or Err if the RNA string is invalid", rna); + todo!("Return a list of protein names that correspond to the '{}' RNA string or Err if the RNA string is invalid", rna); } } pub fn parse<'a>(pairs: Vec<(&'a str, &'a str)>) -> CodonsInfo<'a> { - unimplemented!( + todo!( "Construct a new CodonsInfo struct from given pairs: {:?}", pairs ); diff --git a/exercises/practice/nucleotide-count/src/lib.rs b/exercises/practice/nucleotide-count/src/lib.rs index 40ac5abe3..c91615c21 100644 --- a/exercises/practice/nucleotide-count/src/lib.rs +++ b/exercises/practice/nucleotide-count/src/lib.rs @@ -1,11 +1,9 @@ use std::collections::HashMap; pub fn count(nucleotide: char, dna: &str) -> Result { - unimplemented!( - "How much of nucleotide type '{nucleotide}' is contained inside DNA string '{dna}'?" - ); + todo!("How much of nucleotide type '{nucleotide}' is contained inside DNA string '{dna}'?"); } pub fn nucleotide_counts(dna: &str) -> Result, char> { - unimplemented!("How much of every nucleotide type is contained inside DNA string '{dna}'?"); + todo!("How much of every nucleotide type is contained inside DNA string '{dna}'?"); } diff --git a/exercises/practice/ocr-numbers/src/lib.rs b/exercises/practice/ocr-numbers/src/lib.rs index baea39693..fd08adad5 100644 --- a/exercises/practice/ocr-numbers/src/lib.rs +++ b/exercises/practice/ocr-numbers/src/lib.rs @@ -8,5 +8,5 @@ pub enum Error { } pub fn convert(input: &str) -> Result { - unimplemented!("Convert the input '{input}' to a string"); + todo!("Convert the input '{input}' to a string"); } diff --git a/exercises/practice/paasio/src/lib.rs b/exercises/practice/paasio/src/lib.rs index f530460da..06666d172 100644 --- a/exercises/practice/paasio/src/lib.rs +++ b/exercises/practice/paasio/src/lib.rs @@ -10,25 +10,25 @@ impl ReadStats { // can't be passed through format!(). For actual implementation you will likely // wish to remove the leading underscore so the variable is not ignored. pub fn new(_wrapped: R) -> ReadStats { - unimplemented!() + todo!() } pub fn get_ref(&self) -> &R { - unimplemented!() + todo!() } pub fn bytes_through(&self) -> usize { - unimplemented!() + todo!() } pub fn reads(&self) -> usize { - unimplemented!() + todo!() } } impl Read for ReadStats { fn read(&mut self, buf: &mut [u8]) -> Result { - unimplemented!("Collect statistics about this call reading {buf:?}") + todo!("Collect statistics about this call reading {buf:?}") } } @@ -39,28 +39,28 @@ impl WriteStats { // can't be passed through format!(). For actual implementation you will likely // wish to remove the leading underscore so the variable is not ignored. pub fn new(_wrapped: W) -> WriteStats { - unimplemented!() + todo!() } pub fn get_ref(&self) -> &W { - unimplemented!() + todo!() } pub fn bytes_through(&self) -> usize { - unimplemented!() + todo!() } pub fn writes(&self) -> usize { - unimplemented!() + todo!() } } impl Write for WriteStats { fn write(&mut self, buf: &[u8]) -> Result { - unimplemented!("Collect statistics about this call writing {buf:?}") + todo!("Collect statistics about this call writing {buf:?}") } fn flush(&mut self) -> Result<()> { - unimplemented!() + todo!() } } diff --git a/exercises/practice/palindrome-products/src/lib.rs b/exercises/practice/palindrome-products/src/lib.rs index c90fffdf9..15d3fb609 100644 --- a/exercises/practice/palindrome-products/src/lib.rs +++ b/exercises/practice/palindrome-products/src/lib.rs @@ -8,17 +8,17 @@ pub struct Palindrome(u64); impl Palindrome { /// Create a `Palindrome` only if `value` is in fact a palindrome when represented in base ten. Otherwise, `None`. pub fn new(value: u64) -> Option { - unimplemented!("if the value {value} is a palindrome return Some, otherwise return None"); + todo!("if the value {value} is a palindrome return Some, otherwise return None"); } /// Get the value of this palindrome. pub fn into_inner(self) -> u64 { - unimplemented!("return inner value of a Palindrome"); + todo!("return inner value of a Palindrome"); } } pub fn palindrome_products(min: u64, max: u64) -> Option<(Palindrome, Palindrome)> { - unimplemented!( + todo!( "returns the minimum and maximum number of palindromes of the products of two factors in the range {min} to {max}" ); } diff --git a/exercises/practice/pangram/src/lib.rs b/exercises/practice/pangram/src/lib.rs index f9d959d85..685588e2f 100644 --- a/exercises/practice/pangram/src/lib.rs +++ b/exercises/practice/pangram/src/lib.rs @@ -1,4 +1,4 @@ /// Determine whether a sentence is a pangram. pub fn is_pangram(sentence: &str) -> bool { - unimplemented!("Is {sentence} a pangram?"); + todo!("Is {sentence} a pangram?"); } diff --git a/exercises/practice/parallel-letter-frequency/src/lib.rs b/exercises/practice/parallel-letter-frequency/src/lib.rs index 55933fa5a..43b349c9e 100644 --- a/exercises/practice/parallel-letter-frequency/src/lib.rs +++ b/exercises/practice/parallel-letter-frequency/src/lib.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; pub fn frequency(input: &[&str], worker_count: usize) -> HashMap { - unimplemented!( + todo!( "Count the frequency of letters in the given input '{input:?}'. Ensure that you are using {} to process the input.", match worker_count { 1 => "1 worker".to_string(), diff --git a/exercises/practice/pascals-triangle/src/lib.rs b/exercises/practice/pascals-triangle/src/lib.rs index d7b800e6c..7e7bf3bbf 100644 --- a/exercises/practice/pascals-triangle/src/lib.rs +++ b/exercises/practice/pascals-triangle/src/lib.rs @@ -2,10 +2,10 @@ pub struct PascalsTriangle; impl PascalsTriangle { pub fn new(row_count: u32) -> Self { - unimplemented!("create Pascal's triangle with {row_count} rows"); + todo!("create Pascal's triangle with {row_count} rows"); } pub fn rows(&self) -> Vec> { - unimplemented!(); + todo!(); } } diff --git a/exercises/practice/perfect-numbers/src/lib.rs b/exercises/practice/perfect-numbers/src/lib.rs index 3448be300..b2257e1b0 100644 --- a/exercises/practice/perfect-numbers/src/lib.rs +++ b/exercises/practice/perfect-numbers/src/lib.rs @@ -6,5 +6,5 @@ pub enum Classification { } pub fn classify(num: u64) -> Option { - unimplemented!("classify {num}"); + todo!("classify {num}"); } diff --git a/exercises/practice/phone-number/src/lib.rs b/exercises/practice/phone-number/src/lib.rs index 59a1747c1..af53e11c8 100644 --- a/exercises/practice/phone-number/src/lib.rs +++ b/exercises/practice/phone-number/src/lib.rs @@ -1,5 +1,5 @@ pub fn number(user_number: &str) -> Option { - unimplemented!( + todo!( "Given the number entered by user '{user_number}', convert it into SMS-friendly format. If the entered number is not a valid NANP number, return None." ); } diff --git a/exercises/practice/pig-latin/src/lib.rs b/exercises/practice/pig-latin/src/lib.rs index 928972389..f395af0b8 100644 --- a/exercises/practice/pig-latin/src/lib.rs +++ b/exercises/practice/pig-latin/src/lib.rs @@ -1,5 +1,3 @@ pub fn translate(input: &str) -> String { - unimplemented!( - "Using the Pig Latin text transformation rules, convert the given input '{input}'" - ); + todo!("Using the Pig Latin text transformation rules, convert the given input '{input}'"); } diff --git a/exercises/practice/poker/src/lib.rs b/exercises/practice/poker/src/lib.rs index 802f080ef..a6f117e30 100644 --- a/exercises/practice/poker/src/lib.rs +++ b/exercises/practice/poker/src/lib.rs @@ -3,5 +3,5 @@ /// Note the type signature: this function should return _the same_ reference to /// the winning hand(s) as were passed in, not reconstructed strings which happen to be equal. pub fn winning_hands<'a>(hands: &[&'a str]) -> Vec<&'a str> { - unimplemented!("Out of {hands:?}, which hand wins?") + todo!("Out of {hands:?}, which hand wins?") } diff --git a/exercises/practice/prime-factors/src/lib.rs b/exercises/practice/prime-factors/src/lib.rs index a2ce597a3..30d06a2fc 100644 --- a/exercises/practice/prime-factors/src/lib.rs +++ b/exercises/practice/prime-factors/src/lib.rs @@ -1,3 +1,3 @@ pub fn factors(n: u64) -> Vec { - unimplemented!("This should calculate the prime factors of {n}") + todo!("This should calculate the prime factors of {n}") } diff --git a/exercises/practice/protein-translation/src/lib.rs b/exercises/practice/protein-translation/src/lib.rs index 10fac37a7..af6df1b72 100644 --- a/exercises/practice/protein-translation/src/lib.rs +++ b/exercises/practice/protein-translation/src/lib.rs @@ -6,16 +6,14 @@ pub struct CodonsInfo<'a> { impl<'a> CodonsInfo<'a> { pub fn name_for(&self, codon: &str) -> Option<&'a str> { - unimplemented!( - "Return the protein name for a '{codon}' codon or None, if codon string is invalid" - ); + todo!("Return the protein name for a '{codon}' codon or None, if codon string is invalid"); } pub fn of_rna(&self, rna: &str) -> Option> { - unimplemented!("Return a list of protein names that correspond to the '{rna}' RNA string or None if the RNA string is invalid"); + todo!("Return a list of protein names that correspond to the '{rna}' RNA string or None if the RNA string is invalid"); } } pub fn parse<'a>(pairs: Vec<(&'a str, &'a str)>) -> CodonsInfo<'a> { - unimplemented!("Construct a new CodonsInfo struct from given pairs: {pairs:?}"); + todo!("Construct a new CodonsInfo struct from given pairs: {pairs:?}"); } diff --git a/exercises/practice/proverb/src/lib.rs b/exercises/practice/proverb/src/lib.rs index ec19e2686..56705813e 100644 --- a/exercises/practice/proverb/src/lib.rs +++ b/exercises/practice/proverb/src/lib.rs @@ -1,3 +1,3 @@ pub fn build_proverb(list: &[&str]) -> String { - unimplemented!("build a proverb from this list of items: {list:?}") + todo!("build a proverb from this list of items: {list:?}") } diff --git a/exercises/practice/pythagorean-triplet/src/lib.rs b/exercises/practice/pythagorean-triplet/src/lib.rs index 340d15571..45aa4a457 100644 --- a/exercises/practice/pythagorean-triplet/src/lib.rs +++ b/exercises/practice/pythagorean-triplet/src/lib.rs @@ -1,5 +1,5 @@ use std::collections::HashSet; pub fn find(sum: u32) -> HashSet<[u32; 3]> { - unimplemented!("Given the sum {sum}, return all possible Pythagorean triplets, which produce the said sum, or an empty HashSet if there are no such triplets. Note that you are expected to return triplets in [a, b, c] order, where a < b < c"); + todo!("Given the sum {sum}, return all possible Pythagorean triplets, which produce the said sum, or an empty HashSet if there are no such triplets. Note that you are expected to return triplets in [a, b, c] order, where a < b < c"); } diff --git a/exercises/practice/queen-attack/src/lib.rs b/exercises/practice/queen-attack/src/lib.rs index b2139bff0..2c6840034 100644 --- a/exercises/practice/queen-attack/src/lib.rs +++ b/exercises/practice/queen-attack/src/lib.rs @@ -6,7 +6,7 @@ pub struct Queen; impl ChessPosition { pub fn new(rank: i32, file: i32) -> Option { - unimplemented!( + todo!( "Construct a ChessPosition struct, given the following rank, file: ({rank}, {file}). If the position is invalid return None." ); } @@ -14,10 +14,10 @@ impl ChessPosition { impl Queen { pub fn new(position: ChessPosition) -> Self { - unimplemented!("Given the chess position {position:?}, construct a Queen struct."); + todo!("Given the chess position {position:?}, construct a Queen struct."); } pub fn can_attack(&self, other: &Queen) -> bool { - unimplemented!("Determine if this Queen can attack the other Queen {other:?}"); + todo!("Determine if this Queen can attack the other Queen {other:?}"); } } diff --git a/exercises/practice/rail-fence-cipher/src/lib.rs b/exercises/practice/rail-fence-cipher/src/lib.rs index 498d827bb..4b72261ce 100644 --- a/exercises/practice/rail-fence-cipher/src/lib.rs +++ b/exercises/practice/rail-fence-cipher/src/lib.rs @@ -2,14 +2,14 @@ pub struct RailFence; impl RailFence { pub fn new(rails: u32) -> RailFence { - unimplemented!("Construct a new fence with {rails} rails") + todo!("Construct a new fence with {rails} rails") } pub fn encode(&self, text: &str) -> String { - unimplemented!("Encode this text: {text}") + todo!("Encode this text: {text}") } pub fn decode(&self, cipher: &str) -> String { - unimplemented!("Decode this ciphertext: {cipher}") + todo!("Decode this ciphertext: {cipher}") } } diff --git a/exercises/practice/raindrops/src/lib.rs b/exercises/practice/raindrops/src/lib.rs index 6bcb31cdd..c16e39c18 100644 --- a/exercises/practice/raindrops/src/lib.rs +++ b/exercises/practice/raindrops/src/lib.rs @@ -1,3 +1,3 @@ pub fn raindrops(n: u32) -> String { - unimplemented!("what sound does Raindrop #{n} make?") + todo!("what sound does Raindrop #{n} make?") } diff --git a/exercises/practice/react/src/lib.rs b/exercises/practice/react/src/lib.rs index f87356c4d..0885ae2d3 100644 --- a/exercises/practice/react/src/lib.rs +++ b/exercises/practice/react/src/lib.rs @@ -41,12 +41,12 @@ pub struct Reactor { // You are guaranteed that Reactor will only be tested against types that are Copy + PartialEq. impl Reactor { pub fn new() -> Self { - unimplemented!() + todo!() } // Creates an input cell with the specified initial value, returning its ID. pub fn create_input(&mut self, _initial: T) -> InputCellId { - unimplemented!() + todo!() } // Creates a compute cell with the specified dependencies and compute function. @@ -67,7 +67,7 @@ impl Reactor { _dependencies: &[CellId], _compute_func: F, ) -> Result { - unimplemented!() + todo!() } // Retrieves the current value of the cell, or None if the cell does not exist. @@ -78,7 +78,7 @@ impl Reactor { // It turns out this introduces a significant amount of extra complexity to this exercise. // We chose not to cover this here, since this exercise is probably enough work as-is. pub fn value(&self, id: CellId) -> Option { - unimplemented!("Get the value of the cell whose id is {id:?}") + todo!("Get the value of the cell whose id is {id:?}") } // Sets the value of the specified input cell. @@ -90,7 +90,7 @@ impl Reactor { // // As before, that turned out to add too much extra complexity. pub fn set_value(&mut self, _id: InputCellId, _new_value: T) -> bool { - unimplemented!() + todo!() } // Adds a callback to the specified compute cell. @@ -110,7 +110,7 @@ impl Reactor { _id: ComputeCellId, _callback: F, ) -> Option { - unimplemented!() + todo!() } // Removes the specified callback, using an ID returned from add_callback. @@ -123,7 +123,7 @@ impl Reactor { cell: ComputeCellId, callback: CallbackId, ) -> Result<(), RemoveCallbackError> { - unimplemented!( + todo!( "Remove the callback identified by the CallbackId {callback:?} from the cell {cell:?}" ) } diff --git a/exercises/practice/rectangles/src/lib.rs b/exercises/practice/rectangles/src/lib.rs index 3644efa33..118113a8f 100644 --- a/exercises/practice/rectangles/src/lib.rs +++ b/exercises/practice/rectangles/src/lib.rs @@ -1,3 +1,3 @@ pub fn count(lines: &[&str]) -> u32 { - unimplemented!("\nDetermine the count of rectangles in the ASCII diagram represented by the following lines:\n{lines:#?}\n."); + todo!("\nDetermine the count of rectangles in the ASCII diagram represented by the following lines:\n{lines:#?}\n."); } diff --git a/exercises/practice/reverse-string/src/lib.rs b/exercises/practice/reverse-string/src/lib.rs index bdfce8c1f..01e0d4dc8 100644 --- a/exercises/practice/reverse-string/src/lib.rs +++ b/exercises/practice/reverse-string/src/lib.rs @@ -1,3 +1,3 @@ pub fn reverse(input: &str) -> String { - unimplemented!("Write a function to reverse {input}"); + todo!("Write a function to reverse {input}"); } diff --git a/exercises/practice/rna-transcription/src/lib.rs b/exercises/practice/rna-transcription/src/lib.rs index ec9c7bfc7..9a406c460 100644 --- a/exercises/practice/rna-transcription/src/lib.rs +++ b/exercises/practice/rna-transcription/src/lib.rs @@ -6,16 +6,16 @@ pub struct Rna; impl Dna { pub fn new(dna: &str) -> Result { - unimplemented!("Construct new Dna from '{dna}' string. If string contains invalid nucleotides return index of first invalid nucleotide"); + todo!("Construct new Dna from '{dna}' string. If string contains invalid nucleotides return index of first invalid nucleotide"); } pub fn into_rna(self) -> Rna { - unimplemented!("Transform Dna {self:?} into corresponding Rna"); + todo!("Transform Dna {self:?} into corresponding Rna"); } } impl Rna { pub fn new(rna: &str) -> Result { - unimplemented!("Construct new Rna from '{rna}' string. If string contains invalid nucleotides return index of first invalid nucleotide"); + todo!("Construct new Rna from '{rna}' string. If string contains invalid nucleotides return index of first invalid nucleotide"); } } diff --git a/exercises/practice/robot-name/src/lib.rs b/exercises/practice/robot-name/src/lib.rs index a2e05a17b..37bf158ed 100644 --- a/exercises/practice/robot-name/src/lib.rs +++ b/exercises/practice/robot-name/src/lib.rs @@ -2,14 +2,14 @@ pub struct Robot; impl Robot { pub fn new() -> Self { - unimplemented!("Construct a new Robot struct."); + todo!("Construct a new Robot struct."); } pub fn name(&self) -> &str { - unimplemented!("Return the reference to the robot's name."); + todo!("Return the reference to the robot's name."); } pub fn reset_name(&mut self) { - unimplemented!("Assign a new unique name to the robot."); + todo!("Assign a new unique name to the robot."); } } diff --git a/exercises/practice/robot-simulator/src/lib.rs b/exercises/practice/robot-simulator/src/lib.rs index f9f605fbf..ff3fab8ca 100644 --- a/exercises/practice/robot-simulator/src/lib.rs +++ b/exercises/practice/robot-simulator/src/lib.rs @@ -13,34 +13,34 @@ pub struct Robot; impl Robot { pub fn new(x: i32, y: i32, d: Direction) -> Self { - unimplemented!("Create a robot at (x, y) ({x}, {y}) facing {d:?}") + todo!("Create a robot at (x, y) ({x}, {y}) facing {d:?}") } #[must_use] pub fn turn_right(self) -> Self { - unimplemented!() + todo!() } #[must_use] pub fn turn_left(self) -> Self { - unimplemented!() + todo!() } #[must_use] pub fn advance(self) -> Self { - unimplemented!() + todo!() } #[must_use] pub fn instructions(self, instructions: &str) -> Self { - unimplemented!("Follow the given sequence of instructions: {instructions}") + todo!("Follow the given sequence of instructions: {instructions}") } pub fn position(&self) -> (i32, i32) { - unimplemented!() + todo!() } pub fn direction(&self) -> &Direction { - unimplemented!() + todo!() } } diff --git a/exercises/practice/roman-numerals/src/lib.rs b/exercises/practice/roman-numerals/src/lib.rs index 5c9d1b600..97ae5cf73 100644 --- a/exercises/practice/roman-numerals/src/lib.rs +++ b/exercises/practice/roman-numerals/src/lib.rs @@ -4,12 +4,12 @@ pub struct Roman; impl Display for Roman { fn fmt(&self, _f: &mut Formatter<'_>) -> Result { - unimplemented!("Return a roman-numeral string representation of the Roman object"); + todo!("Return a roman-numeral string representation of the Roman object"); } } impl From for Roman { fn from(num: u32) -> Self { - unimplemented!("Construct a Roman object from the '{num}' number"); + todo!("Construct a Roman object from the '{num}' number"); } } diff --git a/exercises/practice/rotational-cipher/src/lib.rs b/exercises/practice/rotational-cipher/src/lib.rs index 9f59d656e..9629515d0 100644 --- a/exercises/practice/rotational-cipher/src/lib.rs +++ b/exercises/practice/rotational-cipher/src/lib.rs @@ -1,5 +1,5 @@ pub fn rotate(input: &str, key: i8) -> String { - unimplemented!( + todo!( "How would input text '{input}' transform when every letter is shifted using key '{key}'?" ); } diff --git a/exercises/practice/run-length-encoding/src/lib.rs b/exercises/practice/run-length-encoding/src/lib.rs index 1860bed48..9b830aec9 100644 --- a/exercises/practice/run-length-encoding/src/lib.rs +++ b/exercises/practice/run-length-encoding/src/lib.rs @@ -1,7 +1,7 @@ pub fn encode(source: &str) -> String { - unimplemented!("Return the run-length encoding of {source}."); + todo!("Return the run-length encoding of {source}."); } pub fn decode(source: &str) -> String { - unimplemented!("Return the run-length decoding of {source}."); + todo!("Return the run-length decoding of {source}."); } diff --git a/exercises/practice/saddle-points/src/lib.rs b/exercises/practice/saddle-points/src/lib.rs index b9126326e..5e3a95bcd 100644 --- a/exercises/practice/saddle-points/src/lib.rs +++ b/exercises/practice/saddle-points/src/lib.rs @@ -1,3 +1,3 @@ pub fn find_saddle_points(input: &[Vec]) -> Vec<(usize, usize)> { - unimplemented!("find the saddle points of the following matrix: {input:?}") + todo!("find the saddle points of the following matrix: {input:?}") } diff --git a/exercises/practice/say/src/lib.rs b/exercises/practice/say/src/lib.rs index e10f3f3f1..38ddc45ed 100644 --- a/exercises/practice/say/src/lib.rs +++ b/exercises/practice/say/src/lib.rs @@ -1,3 +1,3 @@ pub fn encode(n: u64) -> String { - unimplemented!("Say {n} in English."); + todo!("Say {n} in English."); } diff --git a/exercises/practice/scale-generator/src/lib.rs b/exercises/practice/scale-generator/src/lib.rs index 74d8a0201..3cf6503c5 100644 --- a/exercises/practice/scale-generator/src/lib.rs +++ b/exercises/practice/scale-generator/src/lib.rs @@ -16,14 +16,14 @@ pub struct Scale; impl Scale { pub fn new(tonic: &str, intervals: &str) -> Result { - unimplemented!("Construct a new scale with tonic {tonic} and intervals {intervals}") + todo!("Construct a new scale with tonic {tonic} and intervals {intervals}") } pub fn chromatic(tonic: &str) -> Result { - unimplemented!("Construct a new chromatic scale with tonic {tonic}") + todo!("Construct a new chromatic scale with tonic {tonic}") } pub fn enumerate(&self) -> Vec { - unimplemented!() + todo!() } } diff --git a/exercises/practice/scrabble-score/src/lib.rs b/exercises/practice/scrabble-score/src/lib.rs index bd9a9d35d..d875e1977 100644 --- a/exercises/practice/scrabble-score/src/lib.rs +++ b/exercises/practice/scrabble-score/src/lib.rs @@ -1,4 +1,4 @@ /// Compute the Scrabble score for a word. pub fn score(word: &str) -> u64 { - unimplemented!("Score {word} in Scrabble."); + todo!("Score {word} in Scrabble."); } diff --git a/exercises/practice/secret-handshake/src/lib.rs b/exercises/practice/secret-handshake/src/lib.rs index 1666587dd..98f52b19e 100644 --- a/exercises/practice/secret-handshake/src/lib.rs +++ b/exercises/practice/secret-handshake/src/lib.rs @@ -1,3 +1,3 @@ pub fn actions(n: u8) -> Vec<&'static str> { - unimplemented!("What is the secret handshake for {n}?") + todo!("What is the secret handshake for {n}?") } diff --git a/exercises/practice/series/src/lib.rs b/exercises/practice/series/src/lib.rs index 9337bb7af..e73729f6c 100644 --- a/exercises/practice/series/src/lib.rs +++ b/exercises/practice/series/src/lib.rs @@ -1,3 +1,3 @@ pub fn series(digits: &str, len: usize) -> Vec { - unimplemented!("What are the series of length {len} in string {digits:?}") + todo!("What are the series of length {len} in string {digits:?}") } diff --git a/exercises/practice/sieve/src/lib.rs b/exercises/practice/sieve/src/lib.rs index 7f5d35f30..23a75707c 100644 --- a/exercises/practice/sieve/src/lib.rs +++ b/exercises/practice/sieve/src/lib.rs @@ -1,3 +1,3 @@ pub fn primes_up_to(upper_bound: u64) -> Vec { - unimplemented!("Construct a vector of all primes up to {upper_bound}"); + todo!("Construct a vector of all primes up to {upper_bound}"); } diff --git a/exercises/practice/simple-cipher/src/lib.rs b/exercises/practice/simple-cipher/src/lib.rs index 847d76533..b3ab8b141 100644 --- a/exercises/practice/simple-cipher/src/lib.rs +++ b/exercises/practice/simple-cipher/src/lib.rs @@ -1,13 +1,11 @@ pub fn encode(key: &str, s: &str) -> Option { - unimplemented!("Use {key} to encode {s} using shift cipher") + todo!("Use {key} to encode {s} using shift cipher") } pub fn decode(key: &str, s: &str) -> Option { - unimplemented!("Use {key} to decode {s} using shift cipher") + todo!("Use {key} to decode {s} using shift cipher") } pub fn encode_random(s: &str) -> (String, String) { - unimplemented!( - "Generate random key with only a-z chars and encode {s}. Return tuple (key, encoded s)" - ) + todo!("Generate random key with only a-z chars and encode {s}. Return tuple (key, encoded s)") } diff --git a/exercises/practice/simple-linked-list/src/lib.rs b/exercises/practice/simple-linked-list/src/lib.rs index 8d7d5cc44..f8597f8ef 100644 --- a/exercises/practice/simple-linked-list/src/lib.rs +++ b/exercises/practice/simple-linked-list/src/lib.rs @@ -8,7 +8,7 @@ pub struct SimpleLinkedList { impl SimpleLinkedList { pub fn new() -> Self { - unimplemented!() + todo!() } // You may be wondering why it's necessary to have is_empty() @@ -17,34 +17,34 @@ impl SimpleLinkedList { // whereas is_empty() is almost always cheap. // (Also ask yourself whether len() is expensive for SimpleLinkedList) pub fn is_empty(&self) -> bool { - unimplemented!() + todo!() } pub fn len(&self) -> usize { - unimplemented!() + todo!() } pub fn push(&mut self, _element: T) { - unimplemented!() + todo!() } pub fn pop(&mut self) -> Option { - unimplemented!() + todo!() } pub fn peek(&self) -> Option<&T> { - unimplemented!() + todo!() } #[must_use] pub fn rev(self) -> SimpleLinkedList { - unimplemented!() + todo!() } } impl FromIterator for SimpleLinkedList { fn from_iter>(_iter: I) -> Self { - unimplemented!() + todo!() } } @@ -61,6 +61,6 @@ impl FromIterator for SimpleLinkedList { impl From> for Vec { fn from(mut _linked_list: SimpleLinkedList) -> Vec { - unimplemented!() + todo!() } } diff --git a/exercises/practice/space-age/src/lib.rs b/exercises/practice/space-age/src/lib.rs index 59d904771..fd180d47c 100644 --- a/exercises/practice/space-age/src/lib.rs +++ b/exercises/practice/space-age/src/lib.rs @@ -6,15 +6,13 @@ pub struct Duration; impl From for Duration { fn from(s: u64) -> Self { - unimplemented!("s, measured in seconds: {s}") + todo!("s, measured in seconds: {s}") } } pub trait Planet { fn years_during(d: &Duration) -> f64 { - unimplemented!( - "convert a duration ({d:?}) to the number of years on this planet for that duration" - ); + todo!("convert a duration ({d:?}) to the number of years on this planet for that duration"); } } diff --git a/exercises/practice/spiral-matrix/src/lib.rs b/exercises/practice/spiral-matrix/src/lib.rs index 79037e487..16d2d2ccd 100644 --- a/exercises/practice/spiral-matrix/src/lib.rs +++ b/exercises/practice/spiral-matrix/src/lib.rs @@ -1,3 +1,3 @@ pub fn spiral_matrix(size: u32) -> Vec> { - unimplemented!("Function that returns the spiral matrix of square size {size}"); + todo!("Function that returns the spiral matrix of square size {size}"); } diff --git a/exercises/practice/sublist/src/lib.rs b/exercises/practice/sublist/src/lib.rs index 95205e5aa..96b2c1a09 100644 --- a/exercises/practice/sublist/src/lib.rs +++ b/exercises/practice/sublist/src/lib.rs @@ -7,5 +7,5 @@ pub enum Comparison { } pub fn sublist(_first_list: &[T], _second_list: &[T]) -> Comparison { - unimplemented!("Determine if the first list is equal to, sublist of, superlist of or unequal to the second list."); + todo!("Determine if the first list is equal to, sublist of, superlist of or unequal to the second list."); } diff --git a/exercises/practice/sum-of-multiples/src/lib.rs b/exercises/practice/sum-of-multiples/src/lib.rs index 09a5c5be5..c5e1645e6 100644 --- a/exercises/practice/sum-of-multiples/src/lib.rs +++ b/exercises/practice/sum-of-multiples/src/lib.rs @@ -1,3 +1,3 @@ pub fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 { - unimplemented!("Sum the multiples of all of {factors:?} which are less than {limit}") + todo!("Sum the multiples of all of {factors:?} which are less than {limit}") } diff --git a/exercises/practice/tournament/src/lib.rs b/exercises/practice/tournament/src/lib.rs index 47b3d36de..780d3acf8 100644 --- a/exercises/practice/tournament/src/lib.rs +++ b/exercises/practice/tournament/src/lib.rs @@ -1,5 +1,5 @@ pub fn tally(match_results: &str) -> String { - unimplemented!( + todo!( "Given the result of the played matches '{match_results}' return a properly formatted tally table string." ); } diff --git a/exercises/practice/triangle/src/lib.rs b/exercises/practice/triangle/src/lib.rs index f7f365798..be8ce7a76 100644 --- a/exercises/practice/triangle/src/lib.rs +++ b/exercises/practice/triangle/src/lib.rs @@ -2,18 +2,18 @@ pub struct Triangle; impl Triangle { pub fn build(sides: [u64; 3]) -> Option { - unimplemented!("Construct new Triangle from following sides: {sides:?}. Return None if the sides are invalid."); + todo!("Construct new Triangle from following sides: {sides:?}. Return None if the sides are invalid."); } pub fn is_equilateral(&self) -> bool { - unimplemented!("Determine if the Triangle is equilateral."); + todo!("Determine if the Triangle is equilateral."); } pub fn is_scalene(&self) -> bool { - unimplemented!("Determine if the Triangle is scalene."); + todo!("Determine if the Triangle is scalene."); } pub fn is_isosceles(&self) -> bool { - unimplemented!("Determine if the Triangle is isosceles."); + todo!("Determine if the Triangle is isosceles."); } } diff --git a/exercises/practice/two-bucket/src/lib.rs b/exercises/practice/two-bucket/src/lib.rs index 801d4c382..ae20764d7 100644 --- a/exercises/practice/two-bucket/src/lib.rs +++ b/exercises/practice/two-bucket/src/lib.rs @@ -23,7 +23,7 @@ pub fn solve( goal: u8, start_bucket: &Bucket, ) -> Option { - unimplemented!( + todo!( "Given one bucket of capacity {capacity_1}, another of capacity {capacity_2}, starting with {start_bucket:?}, find pours to reach {goal}, or None if impossible" ); } diff --git a/exercises/practice/two-fer/src/lib.rs b/exercises/practice/two-fer/src/lib.rs index 1c8494223..f7993705b 100644 --- a/exercises/practice/two-fer/src/lib.rs +++ b/exercises/practice/two-fer/src/lib.rs @@ -1,3 +1,3 @@ pub fn twofer(name: &str) -> String { - unimplemented!("how many for {name}") + todo!("how many for {name}") } diff --git a/exercises/practice/variable-length-quantity/src/lib.rs b/exercises/practice/variable-length-quantity/src/lib.rs index f60834668..76097b80d 100644 --- a/exercises/practice/variable-length-quantity/src/lib.rs +++ b/exercises/practice/variable-length-quantity/src/lib.rs @@ -6,10 +6,10 @@ pub enum Error { /// Convert a list of numbers to a stream of bytes encoded with variable length encoding. pub fn to_bytes(values: &[u32]) -> Vec { - unimplemented!("Convert the values {values:?} to a list of bytes") + todo!("Convert the values {values:?} to a list of bytes") } /// Given a stream of bytes, extract all numbers which are encoded in there. pub fn from_bytes(bytes: &[u8]) -> Result, Error> { - unimplemented!("Convert the list of bytes {bytes:?} to a list of numbers") + todo!("Convert the list of bytes {bytes:?} to a list of numbers") } diff --git a/exercises/practice/word-count/src/lib.rs b/exercises/practice/word-count/src/lib.rs index 62d0cad60..a0e9034ef 100644 --- a/exercises/practice/word-count/src/lib.rs +++ b/exercises/practice/word-count/src/lib.rs @@ -2,5 +2,5 @@ use std::collections::HashMap; /// Count occurrences of words. pub fn word_count(words: &str) -> HashMap { - unimplemented!("Count of occurrences of words in {words:?}"); + todo!("Count of occurrences of words in {words:?}"); } diff --git a/exercises/practice/wordy/src/lib.rs b/exercises/practice/wordy/src/lib.rs index 229739568..dff74fdac 100644 --- a/exercises/practice/wordy/src/lib.rs +++ b/exercises/practice/wordy/src/lib.rs @@ -1,5 +1,3 @@ pub fn answer(command: &str) -> Option { - unimplemented!( - "Return the result of the command '{command}' or None, if the command is invalid." - ); + todo!("Return the result of the command '{command}' or None, if the command is invalid."); } diff --git a/exercises/practice/xorcism/src/lib.rs b/exercises/practice/xorcism/src/lib.rs index 59adc045a..a471a03f1 100644 --- a/exercises/practice/xorcism/src/lib.rs +++ b/exercises/practice/xorcism/src/lib.rs @@ -11,7 +11,7 @@ impl<'a> Xorcism<'a> { /// /// Should accept anything which has a cheap conversion to a byte slice. pub fn new(key: &Key) -> Xorcism<'a> { - unimplemented!() + todo!() } /// XOR each byte of the input buffer with a byte from the key. @@ -19,7 +19,7 @@ impl<'a> Xorcism<'a> { /// Note that this is stateful: repeated calls are likely to produce different results, /// even with identical inputs. pub fn munge_in_place(&mut self, data: &mut [u8]) { - unimplemented!() + todo!() } /// XOR each byte of the data with a byte from the key. @@ -30,7 +30,7 @@ impl<'a> Xorcism<'a> { /// Should accept anything which has a cheap conversion to a byte iterator. /// Shouldn't matter whether the byte iterator's values are owned or borrowed. pub fn munge(&mut self, data: Data) -> impl Iterator { - unimplemented!(); + todo!(); // this empty iterator silences a compiler complaint that // () doesn't implement ExactSizeIterator std::iter::empty() diff --git a/exercises/practice/yacht/src/lib.rs b/exercises/practice/yacht/src/lib.rs index 58a29766d..1e92e6e84 100644 --- a/exercises/practice/yacht/src/lib.rs +++ b/exercises/practice/yacht/src/lib.rs @@ -15,5 +15,5 @@ pub enum Category { type Dice = [u8; 5]; pub fn score(_dice: Dice, _category: Category) -> u8 { - unimplemented!("Solve the Yacht exercise"); + todo!("Solve the Yacht exercise"); } diff --git a/rust-tooling/src/bin/generate_exercise.rs b/rust-tooling/src/bin/generate_exercise.rs index 4a7d08022..135dc4cec 100644 --- a/rust-tooling/src/bin/generate_exercise.rs +++ b/rust-tooling/src/bin/generate_exercise.rs @@ -80,7 +80,7 @@ fn add_entry_to_track_config() -> String { .map(|path| path.file_name().unwrap().to_str().unwrap().to_string()) .collect::>(); - let unimplemented_with_spec = glob("problem-specifications/exercises/*") + let todo_with_spec = glob("problem-specifications/exercises/*") .unwrap() .filter_map(Result::ok) .map(|path| path.file_name().unwrap().to_str().unwrap().to_string()) @@ -90,7 +90,7 @@ fn add_entry_to_track_config() -> String { println!("(suggestions are from problem-specifications)"); let slug = Text::new("What's the slug of your exercise?") .with_autocomplete(move |input: &_| { - let mut slugs = unimplemented_with_spec.clone(); + let mut slugs = todo_with_spec.clone(); slugs.retain(|e| e.starts_with(input)); Ok(slugs) })