Skip to content

Commit 91171a6

Browse files
Linting fixes
1 parent c5150ae commit 91171a6

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,7 @@ impl Sample {
441441

442442
let raw_val = &self.buffer[vs..ve];
443443

444-
let v: Value;
445-
v = match vt {
444+
let v: Value = match vt {
446445
Value::INT(_) => {
447446
if vc == 1 {
448447
Value::INT(i32::from_le_bytes(raw_val.try_into().unwrap()))
@@ -478,7 +477,7 @@ impl Sample {
478477
}
479478
Value::DOUBLE(_) => Value::DOUBLE(f64::from_le_bytes(raw_val.try_into().unwrap())),
480479
Value::BITS(_) => Value::BITS(u32::from_le_bytes(raw_val.try_into().unwrap())),
481-
Value::CHAR(_) => Value::CHAR(raw_val[0] as u8),
480+
Value::CHAR(_) => Value::CHAR(raw_val[0]),
482481
Value::BOOL(_) => {
483482
if vc == 1 {
484483
Value::BOOL(raw_val[0] > 0)
@@ -522,7 +521,7 @@ impl Display for TelemetryError {
522521

523522
impl Error for TelemetryError {}
524523

525-
impl<'conn> Blocking<'conn> {
524+
impl Blocking<'_> {
526525
fn new(location: *const c_void) -> std::io::Result<Self> {
527526
let mut event_name: Vec<u16> = DATA_EVENT_NAME.encode_utf16().collect();
528527
event_name.push(0);
@@ -603,7 +602,7 @@ impl<'conn> Blocking<'conn> {
603602
}
604603
}
605604

606-
impl<'conn> Drop for Blocking<'conn> {
605+
impl Drop for Blocking<'_> {
607606
fn drop(&mut self) {
608607
unsafe {
609608
let succ = CloseHandle(self.event_handle);

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)