1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-12-22 14:48:45 +02:00

Introduce a cargo clippy run (#2025)

This might help catch stylistic problems in our Rust code.

Related to #2587.
This commit is contained in:
Martin Geisler
2025-09-20 13:38:54 +02:00
committed by GitHub
parent 80a2f2ff71
commit 1e3be175fa
13 changed files with 81 additions and 57 deletions

View File

@@ -29,7 +29,7 @@ impl User {
// ANCHOR_END: setup
// ANCHOR: User_visit_doctor
pub fn visit_doctor(&mut self, measurements: Measurements) -> HealthReport {
pub fn visit_doctor(&mut self, measurements: Measurements) -> HealthReport<'_> {
// ANCHOR_END: User_visit_doctor
self.visit_count += 1;
let bp = measurements.blood_pressure;
@@ -37,12 +37,9 @@ impl User {
patient_name: &self.name,
visit_count: self.visit_count,
height_change: measurements.height - self.height,
blood_pressure_change: match self.last_blood_pressure {
Some(lbp) => {
Some((bp.0 as i32 - lbp.0 as i32, bp.1 as i32 - lbp.1 as i32))
}
None => None,
},
blood_pressure_change: self
.last_blood_pressure
.map(|lbp| (bp.0 as i32 - lbp.0 as i32, bp.1 as i32 - lbp.1 as i32)),
};
self.height = measurements.height;
self.last_blood_pressure = Some(bp);