From ea3e971854a23eaa6cf159b5557cc34bd646e933 Mon Sep 17 00:00:00 2001 From: Niklas Vousten Date: Sat, 21 Oct 2023 00:22:14 +0200 Subject: [PATCH] Fixed typo in src/ephemeris doc. Removed si feature from default. Changed SI Statevector parsing to make clippy pedantic happy --- Cargo.toml | 3 +-- src/ephemeris.rs | 2 +- src/si/ephemeris.rs | 20 ++++++-------------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dec6870..99fdebf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,5 +22,4 @@ env_logger = "0.9.0" tokio = { version = "1.20.1", features = ["macros", "rt-multi-thread"] } [features] -si = ["dep:uom"] -default= ["si"] \ No newline at end of file +si = ["dep:uom"] \ No newline at end of file diff --git a/src/ephemeris.rs b/src/ephemeris.rs index c0821bd..96378c5 100644 --- a/src/ephemeris.rs +++ b/src/ephemeris.rs @@ -15,7 +15,7 @@ use crate::utilities::{take_expecting, take_or_empty}; /// | RR | Range-rate; radial velocity wrt coord. center | km/sec | #[derive(Debug, PartialEq)] pub struct EphemerisVectorItem { - /// Position int km of the moving body relative to the Sun + /// Position in km of the moving body relative to the Sun /// /// [x, y, z] pub position: [f32; 3], diff --git a/src/si/ephemeris.rs b/src/si/ephemeris.rs index 98d5ed1..f4c9554 100644 --- a/src/si/ephemeris.rs +++ b/src/si/ephemeris.rs @@ -215,15 +215,11 @@ impl<'a, Input: Iterator> Iterator for EphemerisVectorParser<'a, let line = take_expecting(line, " Z =").unwrap(); let (z, _) = take_or_empty(line, 22); - let x_km = x.trim().parse::().unwrap(); - let y_km = y.trim().parse::().unwrap(); - let z_km = z.trim().parse::().unwrap(); - self.state = EphemerisVectorParserState::Position { position: [ - Length::new::(x_km), - Length::new::(y_km), - Length::new::(z_km), + Length::new::(x.trim().parse::().unwrap()), + Length::new::(y.trim().parse::().unwrap()), + Length::new::(z.trim().parse::().unwrap()), ], }; } @@ -238,16 +234,12 @@ impl<'a, Input: Iterator> Iterator for EphemerisVectorParser<'a, let line = take_expecting(line, " VZ=").unwrap(); let (vz, _) = take_or_empty(line, 22); - let vx_kms = vx.trim().parse::().unwrap(); - let vy_kms = vy.trim().parse::().unwrap(); - let vz_kms = vz.trim().parse::().unwrap(); - self.state = EphemerisVectorParserState::Complete { position, velocity: [ - Velocity::new::(vx_kms), - Velocity::new::(vy_kms), - Velocity::new::(vz_kms), + Velocity::new::(vx.trim().parse::().unwrap()), + Velocity::new::(vy.trim().parse::().unwrap()), + Velocity::new::(vz.trim().parse::().unwrap()), ], }; }