Enable clippy::useless_conversion (#8724)

This PR enables the
[`clippy::useless_conversion`](https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-02 16:31:47 -05:00 committed by GitHub
parent 87efb75e53
commit 4b81b15cad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 44 additions and 44 deletions

View file

@ -183,7 +183,7 @@ pub fn grid_point_and_side(
let col = min(col, cur_size.last_column());
let mut line = (pos.y / cur_size.line_height) as i32;
if line > cur_size.bottommost_line() {
line = cur_size.bottommost_line().0 as i32;
line = cur_size.bottommost_line().0;
side = Side::Right;
} else if line < 0 {
side = Side::Left;

View file

@ -1294,8 +1294,7 @@ impl Terminal {
self.last_content.display_offset,
);
if let Some(scrolls) =
scroll_report(point, scroll_lines as i32, e, self.last_content.mode)
if let Some(scrolls) = scroll_report(point, scroll_lines, e, self.last_content.mode)
{
for scroll in scrolls {
self.pty_tx.notify(scroll);
@ -1554,9 +1553,9 @@ fn rgb_for_index(i: &u8) -> (u8, u8, u8) {
pub fn rgba_color(r: u8, g: u8, b: u8) -> Hsla {
Rgba {
r: (r as f32 / 255.) as f32,
g: (g as f32 / 255.) as f32,
b: (b as f32 / 255.) as f32,
r: (r as f32 / 255.),
g: (g as f32 / 255.),
b: (b as f32 / 255.),
a: 1.,
}
.into()
@ -1577,9 +1576,9 @@ mod tests {
#[test]
fn test_rgb_for_index() {
//Test every possible value in the color cube
// Test every possible value in the color cube.
for i in 16..=231 {
let (r, g, b) = rgb_for_index(&(i as u8));
let (r, g, b) = rgb_for_index(&i);
assert_eq!(i, 16 + 36 * r + 6 * g + b);
}
}