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
21 changed files with 44 additions and 44 deletions
+1 -1
View File
@@ -987,7 +987,7 @@ fn offset_for_row(s: &str, target: u32) -> (u32, usize) {
if row >= target {
break;
}
offset += line.len() as usize;
offset += line.len();
}
(row, offset)
}
+2 -2
View File
@@ -296,7 +296,7 @@ impl TabSnapshot {
let (collapsed, expanded_char_column, to_next_stop) =
self.collapse_tabs(chars, expanded, bias);
(
FoldPoint::new(output.row(), collapsed as u32),
FoldPoint::new(output.row(), collapsed),
expanded_char_column,
to_next_stop,
)
@@ -513,7 +513,7 @@ impl<'a> Iterator for TabChunks<'a> {
} else {
self.chunk.text = &self.chunk.text[1..];
let tab_size = if self.input_column < self.max_expansion_column {
self.tab_size.get() as u32
self.tab_size.get()
} else {
1
};
+1 -1
View File
@@ -4107,7 +4107,7 @@ impl Editor {
fold_data
.map(|(fold_status, buffer_row, active)| {
(active || gutter_hovered || fold_status == FoldStatus::Folded).then(|| {
IconButton::new(ix as usize, ui::IconName::ChevronDown)
IconButton::new(ix, ui::IconName::ChevronDown)
.on_click({
let view = editor_view.clone();
move |_e, cx| {
+2 -2
View File
@@ -6752,8 +6752,8 @@ async fn test_following(cx: &mut gpui::TestAppContext) {
cx.open_window(
WindowOptions {
bounds: WindowBounds::Fixed(Bounds::from_corners(
gpui::Point::new((0. as f64).into(), (0. as f64).into()),
gpui::Point::new((10. as f64).into(), (80. as f64).into()),
gpui::Point::new(0_f64.into(), 0_f64.into()),
gpui::Point::new(10_f64.into(), 80_f64.into()),
)),
..Default::default()
},
+3 -4
View File
@@ -1586,7 +1586,7 @@ impl EditorElement {
let new_y = event.position.y;
if (track_bounds.top()..track_bounds.bottom()).contains(&y) {
let mut position = editor.scroll_position(cx);
position.y += (new_y - y) * (max_row as f32) / height;
position.y += (new_y - y) * max_row / height;
if position.y < 0.0 {
position.y = 0.0;
}
@@ -1633,8 +1633,7 @@ impl EditorElement {
let y = event.position.y;
if y < thumb_top || thumb_bottom < y {
let center_row =
((y - top) * max_row as f32 / height).round() as u32;
let center_row = ((y - top) * max_row / height).round() as u32;
let top_row = center_row
.saturating_sub((row_range.end - row_range.start) as u32 / 2);
let mut position = editor.scroll_position(cx);
@@ -1964,7 +1963,7 @@ impl EditorElement {
chunks,
&self.style.text,
MAX_LINE_LEN,
rows.len() as usize,
rows.len(),
line_number_layouts,
snapshot.mode,
cx,
+1 -1
View File
@@ -470,7 +470,7 @@ impl Editor {
.buffer()
.read(cx)
.snapshot(cx)
.anchor_at(Point::new(top_row as u32, 0), Bias::Left);
.anchor_at(Point::new(top_row, 0), Bias::Left);
let scroll_anchor = ScrollAnchor {
offset: gpui::Point::new(x, y),
anchor: top_anchor,