aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-01-08 07:31:19 +0000
committerBlaž Hrastnik2021-01-08 07:37:36 +0000
commit777a80917db01e658139da11a20ff08256667cfe (patch)
treebe813dfd5f59a6f4c4db937c12769927d8d42c13 /helix-term/src
parent7d41550a23fc3506a37016d5bc362144fb00c080 (diff)
Address clippy lints.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs8
-rw-r--r--helix-term/src/main.rs4
-rw-r--r--helix-term/src/ui/editor.rs6
-rw-r--r--helix-term/src/ui/picker.rs9
-rw-r--r--helix-term/src/ui/prompt.rs2
5 files changed, 13 insertions, 16 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index a11c3145..d27ae168 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -291,7 +291,7 @@ pub fn split_selection(cx: &mut Context) {
selection::split_on_matches(text, view.doc.selection(), &regex);
view.doc.set_selection(selection);
}
- Err(_) => (), // TODO: mark command line as error
+ Err(_err) => (), // TODO: mark command line as error
}
}
}
@@ -453,9 +453,9 @@ pub fn command_mode(cx: &mut Context) {
let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
- match parts.as_slice() {
- &["q"] => editor.should_close = true,
- &["o", path] => {
+ match *parts.as_slice() {
+ ["q"] => editor.should_close = true,
+ ["o", path] => {
// TODO: make view()/view_mut() always contain a view.
let size = editor.view().unwrap().size;
editor.open(path.into(), size);
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index f350b4c1..cdaa3924 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -49,7 +49,7 @@ fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> {
Ok(())
}
-fn main() -> Result<(), Error> {
+fn main() {
let args = clap::app_from_crate!()
.arg(
Arg::new("files")
@@ -79,6 +79,4 @@ fn main() -> Result<(), Error> {
// we use the thread local executor to spawn the application task separately from the work pool
smol::block_on(app.run());
-
- Ok(())
}
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 629cb85c..fced9acb 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -170,9 +170,11 @@ impl EditorView {
// ugh, improve with a traverse method
// or interleave highlight spans with selection and diagnostic spans
- let style = if view.doc.diagnostics.iter().any(|diagnostic| {
+ let is_diagnostic = view.doc.diagnostics.iter().any(|diagnostic| {
diagnostic.range.0 <= char_index && diagnostic.range.1 > char_index
- }) {
+ });
+
+ let style = if is_diagnostic {
style.clone().add_modifier(Modifier::UNDERLINED)
} else {
style
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index a46886ee..60828b6f 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -170,12 +170,9 @@ impl<T> Component for Picker<T> {
return close_fn;
}
_ => {
- match self.prompt.handle_event(event, cx) {
- EventResult::Consumed(_) => {
- // TODO: recalculate only if pattern changed
- self.score();
- }
- _ => (),
+ if let EventResult::Consumed(_) = self.prompt.handle_event(event, cx) {
+ // TODO: recalculate only if pattern changed
+ self.score();
}
}
}
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 7abc08c2..5a47bf12 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -126,7 +126,7 @@ impl Prompt {
let color = if self.completion_selection_index.is_some()
&& i == self.completion_selection_index.unwrap()
{
- Style::default().bg(Color::Rgb(104, 060, 232))
+ Style::default().bg(Color::Rgb(104, 60, 232))
} else {
text_color
};