Address clippy lints (#9371)
This commit is contained in:
parent
c60ba4ba04
commit
af8e524a7d
5 changed files with 9 additions and 9 deletions
|
@ -795,7 +795,7 @@ fn goto_buffer(editor: &mut Editor, direction: Direction) {
|
||||||
let iter = editor.documents.keys();
|
let iter = editor.documents.keys();
|
||||||
let mut iter = iter.rev().skip_while(|id| *id != ¤t);
|
let mut iter = iter.rev().skip_while(|id| *id != ¤t);
|
||||||
iter.next(); // skip current item
|
iter.next(); // skip current item
|
||||||
iter.next().or_else(|| editor.documents.keys().rev().next())
|
iter.next().or_else(|| editor.documents.keys().next_back())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -2789,7 +2789,7 @@ fn buffer_picker(cx: &mut Context) {
|
||||||
.editor
|
.editor
|
||||||
.documents
|
.documents
|
||||||
.values()
|
.values()
|
||||||
.map(|doc| new_meta(doc))
|
.map(new_meta)
|
||||||
.collect::<Vec<BufferMeta>>();
|
.collect::<Vec<BufferMeta>>();
|
||||||
|
|
||||||
// mru
|
// mru
|
||||||
|
|
|
@ -78,7 +78,7 @@ fn thread_picker(
|
||||||
})
|
})
|
||||||
.with_preview(move |editor, thread| {
|
.with_preview(move |editor, thread| {
|
||||||
let frames = editor.debugger.as_ref()?.stack_frames.get(&thread.id)?;
|
let frames = editor.debugger.as_ref()?.stack_frames.get(&thread.id)?;
|
||||||
let frame = frames.get(0)?;
|
let frame = frames.first()?;
|
||||||
let path = frame.source.as_ref()?.path.clone()?;
|
let path = frame.source.as_ref()?.path.clone()?;
|
||||||
let pos = Some((
|
let pos = Some((
|
||||||
frame.line.saturating_sub(1),
|
frame.line.saturating_sub(1),
|
||||||
|
@ -166,7 +166,7 @@ pub fn dap_start_impl(
|
||||||
// TODO: avoid refetching all of this... pass a config in
|
// TODO: avoid refetching all of this... pass a config in
|
||||||
let template = match name {
|
let template = match name {
|
||||||
Some(name) => config.templates.iter().find(|t| t.name == name),
|
Some(name) => config.templates.iter().find(|t| t.name == name),
|
||||||
None => config.templates.get(0),
|
None => config.templates.first(),
|
||||||
}
|
}
|
||||||
.ok_or_else(|| anyhow!("No debug config with given name"))?;
|
.ok_or_else(|| anyhow!("No debug config with given name"))?;
|
||||||
|
|
||||||
|
|
|
@ -483,7 +483,7 @@ fn set_indent_style(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to parse argument as an indent style.
|
// Attempt to parse argument as an indent style.
|
||||||
let style = match args.get(0) {
|
let style = match args.first() {
|
||||||
Some(arg) if "tabs".starts_with(&arg.to_lowercase()) => Some(Tabs),
|
Some(arg) if "tabs".starts_with(&arg.to_lowercase()) => Some(Tabs),
|
||||||
Some(Cow::Borrowed("0")) => Some(Tabs),
|
Some(Cow::Borrowed("0")) => Some(Tabs),
|
||||||
Some(arg) => arg
|
Some(arg) => arg
|
||||||
|
@ -535,7 +535,7 @@ fn set_line_ending(
|
||||||
}
|
}
|
||||||
|
|
||||||
let arg = args
|
let arg = args
|
||||||
.get(0)
|
.first()
|
||||||
.context("argument missing")?
|
.context("argument missing")?
|
||||||
.to_ascii_lowercase();
|
.to_ascii_lowercase();
|
||||||
|
|
||||||
|
@ -2078,7 +2078,7 @@ fn reflow(
|
||||||
// - The configured text-width for this language in languages.toml
|
// - The configured text-width for this language in languages.toml
|
||||||
// - The configured text-width in the config.toml
|
// - The configured text-width in the config.toml
|
||||||
let text_width: usize = args
|
let text_width: usize = args
|
||||||
.get(0)
|
.first()
|
||||||
.map(|num| num.parse::<usize>())
|
.map(|num| num.parse::<usize>())
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.or_else(|| doc.language_config().and_then(|config| config.text_width))
|
.or_else(|| doc.language_config().and_then(|config| config.text_width))
|
||||||
|
|
|
@ -319,7 +319,7 @@ impl Keymaps {
|
||||||
self.sticky = None;
|
self.sticky = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let first = self.state.get(0).unwrap_or(&key);
|
let first = self.state.first().unwrap_or(&key);
|
||||||
let trie_node = match self.sticky {
|
let trie_node = match self.sticky {
|
||||||
Some(ref trie) => Cow::Owned(KeyTrie::Node(trie.clone())),
|
Some(ref trie) => Cow::Owned(KeyTrie::Node(trie.clone())),
|
||||||
None => Cow::Borrowed(keymap),
|
None => Cow::Borrowed(keymap),
|
||||||
|
|
|
@ -11,7 +11,7 @@ impl ProgressSpinners {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_or_create(&mut self, id: usize) -> &mut Spinner {
|
pub fn get_or_create(&mut self, id: usize) -> &mut Spinner {
|
||||||
self.inner.entry(id).or_insert_with(Spinner::default)
|
self.inner.entry(id).or_default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue