mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
Fix nightly clippy lints (#4954)
This commit is contained in:
parent
5a3ff74221
commit
a8a54be6bc
@ -2346,8 +2346,8 @@ fn label(&self, _data: &Self::Data) -> Spans {
|
|||||||
let picker = FilePicker::new(
|
let picker = FilePicker::new(
|
||||||
cx.editor
|
cx.editor
|
||||||
.documents
|
.documents
|
||||||
.iter()
|
.values()
|
||||||
.map(|(_, doc)| new_meta(doc))
|
.map(|doc| new_meta(doc))
|
||||||
.collect(),
|
.collect(),
|
||||||
(),
|
(),
|
||||||
|cx, meta, action| {
|
|cx, meta, action| {
|
||||||
|
@ -706,7 +706,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
|
|||||||
if ignore_if_exists && to.exists() {
|
if ignore_if_exists && to.exists() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
fs::rename(&from, &to)
|
fs::rename(from, &to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ fn probe_protocol(protocol_name: &str, server_cmd: Option<String>) -> std::io::R
|
|||||||
writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?;
|
writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?;
|
||||||
|
|
||||||
if let Some(cmd) = server_cmd {
|
if let Some(cmd) = server_cmd {
|
||||||
let path = match which::which(&cmd) {
|
let path = match which::which(cmd) {
|
||||||
Ok(path) => path.display().to_string().green(),
|
Ok(path) => path.display().to_string().green(),
|
||||||
Err(_) => "Not found in $PATH".to_string().red(),
|
Err(_) => "Not found in $PATH".to_string().red(),
|
||||||
};
|
};
|
||||||
|
@ -390,18 +390,18 @@ pub fn get(&mut self, mode: Mode, key: KeyEvent) -> KeymapResult {
|
|||||||
|
|
||||||
self.state.push(key);
|
self.state.push(key);
|
||||||
match trie.search(&self.state[1..]) {
|
match trie.search(&self.state[1..]) {
|
||||||
Some(&KeyTrie::Node(ref map)) => {
|
Some(KeyTrie::Node(map)) => {
|
||||||
if map.is_sticky {
|
if map.is_sticky {
|
||||||
self.state.clear();
|
self.state.clear();
|
||||||
self.sticky = Some(map.clone());
|
self.sticky = Some(map.clone());
|
||||||
}
|
}
|
||||||
KeymapResult::Pending(map.clone())
|
KeymapResult::Pending(map.clone())
|
||||||
}
|
}
|
||||||
Some(&KeyTrie::Leaf(ref cmd)) => {
|
Some(KeyTrie::Leaf(cmd)) => {
|
||||||
self.state.clear();
|
self.state.clear();
|
||||||
KeymapResult::Matched(cmd.clone())
|
KeymapResult::Matched(cmd.clone())
|
||||||
}
|
}
|
||||||
Some(&KeyTrie::Sequence(ref cmds)) => {
|
Some(KeyTrie::Sequence(cmds)) => {
|
||||||
self.state.clear();
|
self.state.clear();
|
||||||
KeymapResult::MatchedSequence(cmds.clone())
|
KeymapResult::MatchedSequence(cmds.clone())
|
||||||
}
|
}
|
||||||
|
@ -516,8 +516,8 @@ pub fn render_text_highlights<H: Iterator<Item = HighlightEvent>>(
|
|||||||
use helix_core::graphemes::{grapheme_width, RopeGraphemes};
|
use helix_core::graphemes::{grapheme_width, RopeGraphemes};
|
||||||
|
|
||||||
for grapheme in RopeGraphemes::new(text) {
|
for grapheme in RopeGraphemes::new(text) {
|
||||||
let out_of_bounds = offset.col > (visual_x as usize)
|
let out_of_bounds = offset.col > visual_x
|
||||||
|| (visual_x as usize) >= viewport.width as usize + offset.col;
|
|| visual_x >= viewport.width as usize + offset.col;
|
||||||
|
|
||||||
if LineEnding::from_rope_slice(&grapheme).is_some() {
|
if LineEnding::from_rope_slice(&grapheme).is_some() {
|
||||||
if !out_of_bounds {
|
if !out_of_bounds {
|
||||||
@ -547,7 +547,7 @@ pub fn render_text_highlights<H: Iterator<Item = HighlightEvent>>(
|
|||||||
let (display_grapheme, width) = if grapheme == "\t" {
|
let (display_grapheme, width) = if grapheme == "\t" {
|
||||||
is_whitespace = true;
|
is_whitespace = true;
|
||||||
// make sure we display tab as appropriate amount of spaces
|
// make sure we display tab as appropriate amount of spaces
|
||||||
let visual_tab_width = tab_width - (visual_x as usize % tab_width);
|
let visual_tab_width = tab_width - (visual_x % tab_width);
|
||||||
let grapheme_tab_width =
|
let grapheme_tab_width =
|
||||||
helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width);
|
helix_core::str_utils::char_to_byte_idx(&tab, visual_tab_width);
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ pub fn render_text_highlights<H: Iterator<Item = HighlightEvent>>(
|
|||||||
(grapheme.as_ref(), width)
|
(grapheme.as_ref(), width)
|
||||||
};
|
};
|
||||||
|
|
||||||
let cut_off_start = offset.col.saturating_sub(visual_x as usize);
|
let cut_off_start = offset.col.saturating_sub(visual_x);
|
||||||
|
|
||||||
if !out_of_bounds {
|
if !out_of_bounds {
|
||||||
// if we're offscreen just keep going until we hit a new line
|
// if we're offscreen just keep going until we hit a new line
|
||||||
@ -583,7 +583,7 @@ pub fn render_text_highlights<H: Iterator<Item = HighlightEvent>>(
|
|||||||
} else if cut_off_start != 0 && cut_off_start < width {
|
} else if cut_off_start != 0 && cut_off_start < width {
|
||||||
// partially on screen
|
// partially on screen
|
||||||
let rect = Rect::new(
|
let rect = Rect::new(
|
||||||
viewport.x as u16,
|
viewport.x,
|
||||||
viewport.y + line,
|
viewport.y + line,
|
||||||
(width - cut_off_start) as u16,
|
(width - cut_off_start) as u16,
|
||||||
1,
|
1,
|
||||||
|
@ -254,8 +254,8 @@ pub fn none(_editor: &Editor, _input: &str) -> Vec<Completion> {
|
|||||||
pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
|
pub fn buffer(editor: &Editor, input: &str) -> Vec<Completion> {
|
||||||
let mut names: Vec<_> = editor
|
let mut names: Vec<_> = editor
|
||||||
.documents
|
.documents
|
||||||
.iter()
|
.values()
|
||||||
.map(|(_id, doc)| {
|
.map(|doc| {
|
||||||
let name = doc
|
let name = doc
|
||||||
.relative_path()
|
.relative_path()
|
||||||
.map(|p| p.display().to_string())
|
.map(|p| p.display().to_string())
|
||||||
|
Loading…
Reference in New Issue
Block a user