Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Feb 5, 2024
1 parent b42686d commit 77c4a9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
6 changes: 3 additions & 3 deletions third_party/cxx/blobstore/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ mod ffi {

/// An iterator over contiguous chunks of a discontiguous file object.
///
/// Toy implementation uses a Vec<Vec<u8>> but in reality this might be iterating
/// over some more complex Rust data structure like a rope, or maybe loading
/// chunks lazily from somewhere.
/// Toy implementation uses a Vec<Vec<u8>> but in reality this might be
/// iterating over some more complex Rust data structure like a rope, or maybe
/// loading chunks lazily from somewhere.
pub struct MultiBuf {
chunks: Vec<Vec<u8>>,
pos: usize,
Expand Down
20 changes: 5 additions & 15 deletions third_party/rust-on-exercism/health-statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ pub struct HealthReport<'a> {

impl User {
pub fn new(name: String, age: u32, height: f32) -> Self {
Self {
name,
age,
height,
visit_count: 0,
last_blood_pressure: None,
}
Self { name, age, height, visit_count: 0, last_blood_pressure: None }
}
// ANCHOR_END: setup

Expand Down Expand Up @@ -68,18 +62,14 @@ fn main() {
fn test_visit() {
let mut bob = User::new(String::from("Bob"), 32, 155.2);
assert_eq!(bob.visit_count, 0);
let report = bob.visit_doctor(Measurements {
height: 156.1,
blood_pressure: (120, 80),
});
let report =
bob.visit_doctor(Measurements { height: 156.1, blood_pressure: (120, 80) });
assert_eq!(report.patient_name, "Bob");
assert_eq!(report.visit_count, 1);
assert_eq!(report.blood_pressure_change, None);

let report = bob.visit_doctor(Measurements {
height: 156.1,
blood_pressure: (115, 76),
});
let report =
bob.visit_doctor(Measurements { height: 156.1, blood_pressure: (115, 76) });

assert_eq!(report.visit_count, 2);
assert_eq!(report.blood_pressure_change, Some((-5, -4)));
Expand Down

0 comments on commit 77c4a9a

Please sign in to comment.