Skip to content

Commit f1b2ba5

Browse files
Linting fixes
1 parent d755c45 commit f1b2ba5

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/replay.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::io;
33
use std::io::Read;
44
use std::io::Result as IOResult;
55
use std::io::{Error as IOError, ErrorKind};
6-
use std::u32;
76

87
/// Magic number found at the start of replay files
98
pub const FILE_MAGIC: &[u8] = b"YLPR";
@@ -170,7 +169,7 @@ fn read_str<R: Read>(mut reader: R, length: usize) -> IOResult<String> {
170169
.position(|&b| b == 0)
171170
.expect("Given string does not terminate within given length");
172171

173-
Ok(String::from_utf8((&raw_string_bytes[..nul]).to_vec()).unwrap())
172+
Ok(String::from_utf8((raw_string_bytes[..nul]).to_vec()).unwrap())
174173
}
175174

176175
impl<R: Read> Replay<R> {

src/telemetry.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,7 @@ impl Sample {
438438

439439
let raw_val = &self.buffer[vs..ve];
440440

441-
let v: Value;
442-
v = match vt {
441+
let v: Value = match vt {
443442
Value::INT(_) => {
444443
if vc == 1 {
445444
Value::INT(i32::from_le_bytes(raw_val.try_into().unwrap()))
@@ -475,7 +474,7 @@ impl Sample {
475474
}
476475
Value::DOUBLE(_) => Value::DOUBLE(f64::from_le_bytes(raw_val.try_into().unwrap())),
477476
Value::BITS(_) => Value::BITS(u32::from_le_bytes(raw_val.try_into().unwrap())),
478-
Value::CHAR(_) => Value::CHAR(raw_val[0] as u8),
477+
Value::CHAR(_) => Value::CHAR(raw_val[0]),
479478
Value::BOOL(_) => {
480479
if vc == 1 {
481480
Value::BOOL(raw_val[0] > 0)
@@ -539,8 +538,8 @@ pub enum SampleError {
539538
NoValue(String),
540539
}
541540

542-
impl<'conn> Blocking<'conn> {
543-
fn new(location: *const c_void) -> IOResult<Self> {
541+
impl Blocking<'_> {
542+
fn new(location: *const c_void) -> std::io::Result<Self> {
544543
let mut event_name: Vec<u16> = DATA_EVENT_NAME.encode_utf16().collect();
545544
event_name.push(0);
546545

@@ -617,7 +616,7 @@ impl<'conn> Blocking<'conn> {
617616
}
618617
}
619618

620-
impl<'conn> Drop for Blocking<'conn> {
619+
impl Drop for Blocking<'_> {
621620
fn drop(&mut self) {
622621
unsafe {
623622
let succ = CloseHandle(self.event_handle);
@@ -800,7 +799,7 @@ mod tests {
800799

801800
#[test]
802801
fn test_latest_telemetry() {
803-
let session_tick: u32 = Connection::new()
802+
let session_tick: Sample = Connection::new()
804803
.expect("Unable to open telemetry")
805804
.telemetry();
806805
}

src/track_surface.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ impl From<i32> for TrackSurface {
2525
match idx {
2626
-1 => TrackSurface::NotInWorld,
2727
0 => TrackSurface::Undefined,
28-
1 | 2 | 3 | 4 => TrackSurface::Asphalt(ix),
28+
1..=4 => TrackSurface::Asphalt(ix),
2929
6 | 7 => TrackSurface::Concrete(ix - 4),
3030
8 | 9 => TrackSurface::RacingDirt(ix - 7),
3131
10 | 11 => TrackSurface::Paint(ix - 9),
32-
12 | 13 | 14 | 15 => TrackSurface::Rumble(ix - 11),
33-
16 | 17 | 18 | 19 => TrackSurface::Grass(ix - 15),
34-
20 | 21 | 22 | 23 => TrackSurface::Dirt(ix - 19),
32+
12..=15 => TrackSurface::Rumble(ix - 11),
33+
16..=19 => TrackSurface::Grass(ix - 15),
34+
20..=23 => TrackSurface::Dirt(ix - 19),
3535
24 => TrackSurface::Sand,
36-
25 | 26 | 27 | 28 => TrackSurface::Gravel(ix - 24),
36+
25..=28 => TrackSurface::Gravel(ix - 24),
3737
29 => TrackSurface::Grasscrete,
3838
30 => TrackSurface::Astroturf,
3939
_ => TrackSurface::Unknown(ix),

0 commit comments

Comments
 (0)