summaryrefslogtreecommitdiff
path: root/exercises/conversions
diff options
context:
space:
mode:
authorBenjamin Jones <benjaminfjones@gmail.com>2020-07-10 19:01:38 -0700
committerBenjamin Jones <bfj@amazon.com>2020-07-11 11:50:54 -0700
commitbb5f404e35f0091b4beb691105e7ed2a94ce4a13 (patch)
tree7ae67dc586f1bdb4ee95dbe960b2f9c6ccaf7b41 /exercises/conversions
parent106dbbc341bd7846745b37e2203e206abf83ed20 (diff)
chore: Alter whitespace for consistency
* Add newline after "I AM DONE" in exercises for consistency * Remove trailing whitespace from exercises
Diffstat (limited to 'exercises/conversions')
-rw-r--r--exercises/conversions/as_ref_mut.rs1
-rw-r--r--exercises/conversions/from_into.rs4
-rw-r--r--exercises/conversions/using_as.rs6
3 files changed, 8 insertions, 3 deletions
diff --git a/exercises/conversions/as_ref_mut.rs b/exercises/conversions/as_ref_mut.rs
index 963c0f2..84f4a60 100644
--- a/exercises/conversions/as_ref_mut.rs
+++ b/exercises/conversions/as_ref_mut.rs
@@ -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 {
diff --git a/exercises/conversions/from_into.rs b/exercises/conversions/from_into.rs
index 8fb9eb0..4f4da53 100644
--- a/exercises/conversions/from_into.rs
+++ b/exercises/conversions/from_into.rs
@@ -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 {
}
diff --git a/exercises/conversions/using_as.rs b/exercises/conversions/using_as.rs
index 54f9651..922abae 100644
--- a/exercises/conversions/using_as.rs
+++ b/exercises/conversions/using_as.rs
@@ -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()
@@ -14,4 +16,4 @@ fn average(values: &[f64]) -> f64 {
fn main() {
let values = [3.5, 0.3, 13.0, 11.7];
println!("{}", average(&values));
-} \ No newline at end of file
+}