Skip to content

Commit c8caeb0

Browse files
authored
General clean up of formatting and clippy warnings (#28)
1 parent 162cb6e commit c8caeb0

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/ephemeris.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::fmt::{Display, Formatter};
1919

2020
/// Number of bytes in the Galileo INAV message
2121
// TODO(jbangelo) bindgen doesn't catch this variable on linux for some reason
22-
pub const GAL_INAV_CONTENT_BYTE: usize = ((128 + 8 - 1) / 8);
22+
pub const GAL_INAV_CONTENT_BYTE: usize = (128 + 8 - 1) / 8;
2323

2424
/// An error indicating that the ephemeris is invalid
2525
#[derive(Copy, Clone, Debug)]
@@ -45,6 +45,8 @@ pub enum Status {
4545
FitIntervalEqualsZero = c_bindings::ephemeris_status_t_EPH_FIT_INTERVAL_EQ_0,
4646
Unhealthy = c_bindings::ephemeris_status_t_EPH_UNHEALTHY,
4747
TooOld = c_bindings::ephemeris_status_t_EPH_TOO_OLD,
48+
InvalidSid = c_bindings::ephemeris_status_t_EPH_INVALID_SID,
49+
InvalidIod = c_bindings::ephemeris_status_t_EPH_INVALID_IOD,
4850
Valid = c_bindings::ephemeris_status_t_EPH_VALID,
4951
}
5052

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Vec3 {
3232
}
3333

3434
pub fn from_array(a: &[f64; 3]) -> Vec3 {
35-
Vec3(a.clone())
35+
Vec3(*a)
3636
}
3737

3838
pub fn get_x(&self) -> f64 {

src/time.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ impl GpsTime {
9494
impl fmt::Debug for GpsTime {
9595
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9696
f.debug_struct("GpsTime")
97-
.field("WN", unsafe { &self.0.wn })
98-
.field("TOW", unsafe { &self.0.tow })
97+
.field("WN", &self.0.wn)
98+
.field("TOW", &self.0.tow)
9999
.finish()
100100
}
101101
}
102102

103103
impl PartialEq for GpsTime {
104104
fn eq(&self, other: &Self) -> bool {
105105
let diff_seconds = self.diff(other).abs();
106-
return diff_seconds < Self::JIFFY;
106+
diff_seconds < Self::JIFFY
107107
}
108108
}
109109

src/troposphere.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mod tests {
2828

2929
#[test]
3030
fn calc_troposphere() {
31-
const d_tol: f64 = 1e-4;
31+
const D_TOL: f64 = 1e-4;
3232

3333
/* some tests against "true" values computed with UNB3M.f */
3434
/* http://www2.unb.ca/gge/Personnel/Santos/UNB_pack.pdf */
@@ -46,7 +46,7 @@ mod tests {
4646
let d_tropo = calc_delay(&t, lat, h, el);
4747

4848
assert!(
49-
(d_tropo - d_true).abs() < d_tol,
49+
(d_tropo - d_true).abs() < D_TOL,
5050
"Distance didn't match hardcoded correct values {:.5}. Saw: {:.5}",
5151
d_true,
5252
d_tropo
@@ -64,7 +64,7 @@ mod tests {
6464
let d_tropo = calc_delay(&t, lat, h, el);
6565

6666
assert!(
67-
(d_tropo - d_true).abs() < d_tol,
67+
(d_tropo - d_true).abs() < D_TOL,
6868
"Distance didn't match hardcoded correct values {:.5}. Saw: {:.5}",
6969
d_true,
7070
d_tropo
@@ -82,7 +82,7 @@ mod tests {
8282
let d_tropo = calc_delay(&t, lat, h, el);
8383

8484
assert!(
85-
(d_tropo - d_true).abs() < d_tol,
85+
(d_tropo - d_true).abs() < D_TOL,
8686
"Distance didn't match hardcoded correct values {:.5}. Saw: {:.5}",
8787
d_true,
8888
d_tropo

0 commit comments

Comments
 (0)