Skip to content

Commit d122304

Browse files
committed
clippy cleanups
1 parent da46ecb commit d122304

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

src/vga/mod.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const MAX_NUM_PIXEL_PAIRS_PER_LINE: usize = MAX_NUM_PIXELS_PER_LINE / 2;
180180
pub const MAX_TEXT_COLS: usize = MAX_NUM_PIXELS_PER_LINE / 8;
181181

182182
/// The highest number of rows in any text mode.
183-
pub const MAX_TEXT_ROWS: usize = MAX_NUM_LINES as usize / 8;
183+
pub const MAX_TEXT_ROWS: usize = MAX_NUM_LINES / 8;
184184

185185
/// Current number of visible columns.
186186
///
@@ -945,8 +945,8 @@ impl TextConsole {
945945
if !buffer.is_null() {
946946
self.write_at(glyph, buffer, &mut row, &mut col);
947947
// Push back to global state
948-
self.current_row.store(row as u16, Ordering::Relaxed);
949-
self.current_col.store(col as u16, Ordering::Relaxed);
948+
self.current_row.store(row, Ordering::Relaxed);
949+
self.current_col.store(col, Ordering::Relaxed);
950950
}
951951
}
952952

@@ -1136,16 +1136,10 @@ impl TextConsole {
11361136
// Stay on last line
11371137
*row = (num_rows - 1) as u16;
11381138

1139-
unsafe {
1140-
core::ptr::copy(
1141-
buffer.add(num_cols as usize),
1142-
buffer,
1143-
num_cols * (num_rows - 1),
1144-
)
1145-
};
1139+
unsafe { core::ptr::copy(buffer.add(num_cols), buffer, num_cols * (num_rows - 1)) };
11461140

11471141
for blank_col in 0..num_cols {
1148-
let offset = (blank_col as usize) + (num_cols * (*row as usize));
1142+
let offset = blank_col + (num_cols * (*row as usize));
11491143
unsafe {
11501144
buffer
11511145
.add(offset)
@@ -1173,8 +1167,8 @@ impl core::fmt::Write for &TextConsole {
11731167
}
11741168

11751169
// Push back to global state
1176-
self.current_row.store(row as u16, Ordering::Relaxed);
1177-
self.current_col.store(col as u16, Ordering::Relaxed);
1170+
self.current_row.store(row, Ordering::Relaxed);
1171+
self.current_col.store(col, Ordering::Relaxed);
11781172
}
11791173

11801174
Ok(())
@@ -1412,11 +1406,11 @@ impl RGBColour {
14121406
}
14131407
}
14141408

1415-
impl Into<crate::common::video::RGBColour> for RGBColour {
1416-
fn into(self) -> crate::common::video::RGBColour {
1417-
let red = self.red8();
1418-
let green = self.green8();
1419-
let blue = self.blue8();
1409+
impl From<RGBColour> for crate::common::video::RGBColour {
1410+
fn from(val: RGBColour) -> crate::common::video::RGBColour {
1411+
let red = val.red8();
1412+
let green = val.green8();
1413+
let blue = val.blue8();
14201414
crate::common::video::RGBColour::from_rgb(red, green, blue)
14211415
}
14221416
}

0 commit comments

Comments
 (0)