Skip to content

Commit a8a54be

Browse files
authored
Fix nightly clippy lints (#4954)
1 parent 5a3ff74 commit a8a54be

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

helix-term/src/commands.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,8 +2346,8 @@ fn buffer_picker(cx: &mut Context) {
23462346
let picker = FilePicker::new(
23472347
cx.editor
23482348
.documents
2349-
.iter()
2350-
.map(|(_, doc)| new_meta(doc))
2349+
.values()
2350+
.map(|doc| new_meta(doc))
23512351
.collect(),
23522352
(),
23532353
|cx, meta, action| {

helix-term/src/commands/lsp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
706706
if ignore_if_exists && to.exists() {
707707
Ok(())
708708
} else {
709-
fs::rename(&from, &to)
709+
fs::rename(from, &to)
710710
}
711711
}
712712
}

helix-term/src/health.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn probe_protocol(protocol_name: &str, server_cmd: Option<String>) -> std::io::R
281281
writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?;
282282

283283
if let Some(cmd) = server_cmd {
284-
let path = match which::which(&cmd) {
284+
let path = match which::which(cmd) {
285285
Ok(path) => path.display().to_string().green(),
286286
Err(_) => "Not found in $PATH".to_string().red(),
287287
};

helix-term/src/keymap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,18 @@ impl Keymaps {
390390

391391
self.state.push(key);
392392
match trie.search(&self.state[1..]) {
393-
Some(&KeyTrie::Node(ref map)) => {
393+
Some(KeyTrie::Node(map)) => {
394394
if map.is_sticky {
395395
self.state.clear();
396396
self.sticky = Some(map.clone());
397397
}
398398
KeymapResult::Pending(map.clone())
399399
}
400-
Some(&KeyTrie::Leaf(ref cmd)) => {
400+
Some(KeyTrie::Leaf(cmd)) => {
401401
self.state.clear();
402402
KeymapResult::Matched(cmd.clone())
403403
}
404-
Some(&KeyTrie::Sequence(ref cmds)) => {
404+
Some(KeyTrie::Sequence(cmds)) => {
405405
self.state.clear();
406406
KeymapResult::MatchedSequence(cmds.clone())
407407
}

helix-term/src/ui/editor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ impl EditorView {
516516
use helix_core::graphemes::{grapheme_width, RopeGraphemes};
517517

518518
for grapheme in RopeGraphemes::new(text) {
519-
let out_of_bounds = offset.col > (visual_x as usize)
520-
|| (visual_x as usize) >= viewport.width as usize + offset.col;
519+
let out_of_bounds = offset.col > visual_x
520+
|| visual_x >= viewport.width as usize + offset.col;
521521

522522
if LineEnding::from_rope_slice(&grapheme).is_some() {
523523
if !out_of_bounds {
@@ -547,7 +547,7 @@ impl EditorView {
547547
let (display_grapheme, width) = if grapheme == "\t" {
548548
is_whitespace = true;
549549
// make sure we display tab as appropriate amount of spaces
550-
let visual_tab_width = tab_width - (visual_x as usize % tab_width);
550+
let visual_tab_width = tab_width - (visual_x % tab_width);
551551
let grapheme_tab_width =
552552
helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width);
553553

@@ -566,7 +566,7 @@ impl EditorView {
566566
(grapheme.as_ref(), width)
567567
};
568568

569-
let cut_off_start = offset.col.saturating_sub(visual_x as usize);
569+
let cut_off_start = offset.col.saturating_sub(visual_x);
570570

571571
if !out_of_bounds {
572572
// if we're offscreen just keep going until we hit a new line
@@ -583,7 +583,7 @@ impl EditorView {
583583
} else if cut_off_start != 0 && cut_off_start < width {
584584
// partially on screen
585585
let rect = Rect::new(
586-
viewport.x as u16,
586+
viewport.x,
587587
viewport.y + line,
588588
(width - cut_off_start) as u16,
589589
1,

helix-term/src/ui/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ pub mod completers {
254254
pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
255255
let mut names: Vec<_> = editor
256256
.documents
257-
.iter()
258-
.map(|(_id, doc)| {
257+
.values()
258+
.map(|doc| {
259259
let name = doc
260260
.relative_path()
261261
.map(|p| p.display().to_string())

0 commit comments

Comments
 (0)