chore: Clean up some formatting in exercises

This commit is contained in:
Russell Cousineau 2019-06-06 19:52:42 -07:00
parent b8d59d699b
commit eb13c2b6af
11 changed files with 19 additions and 19 deletions

View file

@ -17,9 +17,11 @@ mod delicious_snacks {
} }
fn main() { fn main() {
println!("favorite snacks: {} and {}", println!(
"favorite snacks: {} and {}",
delicious_snacks::fruit, delicious_snacks::fruit,
delicious_snacks::veggie); delicious_snacks::veggie
);
} }

View file

@ -11,7 +11,6 @@ fn main() {
vec1.push(88); vec1.push(88);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
} }
fn fill_vec(vec: Vec<i32>) -> Vec<i32> { fn fill_vec(vec: Vec<i32>) -> Vec<i32> {

View file

@ -12,7 +12,6 @@ fn main() {
vec1.push(88); vec1.push(88);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
} }
fn fill_vec(vec: Vec<i32>) -> Vec<i32> { fn fill_vec(vec: Vec<i32>) -> Vec<i32> {

View file

@ -13,7 +13,6 @@ fn main() {
vec1.push(88); vec1.push(88);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
} }
fn fill_vec(vec: Vec<i32>) -> Vec<i32> { fn fill_vec(vec: Vec<i32>) -> Vec<i32> {

View file

@ -13,7 +13,6 @@ fn main() {
vec1.push(88); vec1.push(88);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1); println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
} }
// `fill_vec()` no longer take `vec: Vec<i32>` as argument // `fill_vec()` no longer take `vec: Vec<i32>` as argument

View file

@ -13,8 +13,7 @@ fn main() {
let mut joinhandles = Vec::new(); let mut joinhandles = Vec::new();
for offset in 0..8 { for offset in 0..8 {
joinhandles.push( joinhandles.push(thread::spawn(move || {
thread::spawn(move || {
let mut i = offset; let mut i = offset;
let mut sum = 0; let mut sum = 0;
while i < child_numbers.len() { while i < child_numbers.len() {

View file

@ -23,8 +23,7 @@ pub struct NotDivisibleError {
// This function should calculate `a` divided by `b` if `a` is // This function should calculate `a` divided by `b` if `a` is
// evenly divisible by b. // evenly divisible by b.
// Otherwise, it should return a suitable error. // Otherwise, it should return a suitable error.
pub fn divide(a: i32, b: i32) -> Result<i32, DivisionError> { pub fn divide(a: i32, b: i32) -> Result<i32, DivisionError> {}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -7,8 +7,12 @@
// you think each value is. That is, add either `string_slice` or `string` // you think each value is. That is, add either `string_slice` or `string`
// before the parentheses on each line. If you're right, it will compile! // before the parentheses on each line. If you're right, it will compile!
fn string_slice(arg: &str) { println!("{}", arg); } fn string_slice(arg: &str) {
fn string(arg: String) { println!("{}", arg); } println!("{}", arg);
}
fn string(arg: String) {
println!("{}", arg);
}
fn main() { fn main() {
("blue"); ("blue");