Merge pull request #468 from benjaminfjones/fix/exercise_whitespace

chore: change exercise whitespace for consistency
This commit is contained in:
fmoko 2020-07-11 23:12:58 +02:00 committed by GitHub
commit c2bfcf1c54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 34 additions and 29 deletions

View File

@ -3,6 +3,7 @@
// and https://doc.rust-lang.org/std/convert/trait.AsMut.html, respectively.
// I AM NOT DONE
// Obtain the number of bytes (not characters) in the given argument
// Add the AsRef trait appropriately as a trait bound
fn byte_counter<T>(arg: T) -> usize {

View File

@ -18,7 +18,6 @@ impl Default for Person {
}
}
// I AM NOT DONE
// Your task is to complete this implementation
// in order for the line `let p = Person::from("Mark,20")` to compile
// Please note that you'll need to parse the age component into a `usize`
@ -33,6 +32,9 @@ impl Default for Person {
// 5. Extract the other element from the split operation and parse it into a `usize` as the age
// If while parsing the age, something goes wrong, then return the default of Person
// Otherwise, then return an instantiated Person object with the results
// I AM NOT DONE
impl From<&str> for Person {
fn from(s: &str) -> Person {
}

View File

@ -1,9 +1,11 @@
// Type casting in Rust is done via the usage of the `as` operator.
// Please note that the `as` operator is not only used when type casting.
// It also helps with renaming imports.
//
// The goal is to make sure that the division does not fail to compile
// I AM NOT DONE
// The goal is to make sure that the division does not fail to compile
fn average(values: &[f64]) -> f64 {
let total = values
.iter()

View File

@ -2,6 +2,7 @@
// Rewrite it using generics so that it supports wrapping ANY type.
// I AM NOT DONE
struct Wrapper {
value: u32
}
@ -18,7 +19,7 @@ mod tests {
#[test]
fn store_u32_in_wrapper() {
assert_eq!(Wrapper::new(42).value, 42);
assert_eq!(Wrapper::new(42).value, 42);
}
#[test]

View File

@ -8,6 +8,7 @@
// the second test pass.
// I AM NOT DONE
pub struct ReportCard {
pub grade: f32,
pub student_name: String,

View File

@ -9,13 +9,13 @@
// implementing this trait.
// I AM NOT DONE
trait AppendBar {
fn append_bar(self) -> Self;
}
impl AppendBar for String {
//Add your code here
}
fn main() {
@ -40,5 +40,4 @@ mod tests {
String::from("BarBar")
);
}
}

View File

@ -31,5 +31,4 @@ mod tests {
assert_eq!(foo.pop().unwrap(), String::from("Bar"));
assert_eq!(foo.pop().unwrap(), String::from("Foo"));
}
}