-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
116 changed files
with
249 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
/// Create an empty vector | ||
pub fn create_empty() -> Vec<u8> { | ||
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<u8> { | ||
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. | ||
/// | ||
/// 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<u8> { | ||
unimplemented!() | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/// What should the type of _function be? | ||
pub fn map(input: Vec<i32>, _function: ???) -> Vec<i32> { | ||
unimplemented!("Transform input vector {input:?} using passed function"); | ||
todo!("Transform input vector {input:?} using passed function"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use std::collections::HashMap; | ||
|
||
pub fn solve(input: &str) -> Option<HashMap<char, u8>> { | ||
unimplemented!("Solve the alphametic {input:?}") | ||
todo!("Solve the alphametic {input:?}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:?}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pub fn find(array: &[i32], key: i32) -> Option<usize> { | ||
unimplemented!( | ||
todo!( | ||
"Using the binary search algorithm, find the element '{key}' in the array '{array:?}' and return its index." | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:?}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.