From 0e9ecccfc12f4972360b516bd56222894f315d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 6 Apr 2021 19:45:14 +0900 Subject: [PATCH] clippy: Drop or-patterns for now because they're not on stable rust yet --- helix-lsp/src/client.rs | 16 +++++++--------- helix-term/src/commands.rs | 6 +++--- helix-term/src/ui/prompt.rs | 6 +++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 74f5fa068..49495b849 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -384,13 +384,11 @@ impl Client { let capabilities = self.capabilities.as_ref().unwrap(); let sync_capabilities = match capabilities.text_document_sync { - Some( - lsp::TextDocumentSyncCapability::Kind(kind) - | lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions { - change: Some(kind), - .. - }), - ) => kind, + Some(lsp::TextDocumentSyncCapability::Kind(kind)) + | Some(lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions { + change: Some(kind), + .. + })) => kind, // None | SyncOptions { changes: None } _ => return Ok(()), }; @@ -540,7 +538,7 @@ impl Client { // check if we're able to format match capabilities.document_formatting_provider { - Some(lsp::OneOf::Left(true) | lsp::OneOf::Right(_)) => (), + Some(lsp::OneOf::Left(true)) | Some(lsp::OneOf::Right(_)) => (), // None | Some(false) _ => return Ok(Vec::new()), }; @@ -569,7 +567,7 @@ impl Client { // check if we're able to format match capabilities.document_range_formatting_provider { - Some(lsp::OneOf::Left(true) | lsp::OneOf::Right(_)) => (), + Some(lsp::OneOf::Left(true)) | Some(lsp::OneOf::Right(_)) => (), // None | Some(false) _ => return Ok(Vec::new()), }; diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c3afbd922..4d9c24a03 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -821,15 +821,15 @@ pub fn command_mode(cx: &mut Context) { let parts = input.split_ascii_whitespace().collect::>(); match *parts.as_slice() { - ["q" | "quit"] => { + ["q"] | ["quit"] => { editor.close(editor.view().id); // editor.should_close = true, } - ["o" | "open", path] => { + ["o", path] | ["open", path] => { use helix_view::editor::Action; editor.open(path.into(), Action::Replace); } - ["w" | "write"] => { + ["w"] | ["write"] => { // TODO: non-blocking via save() command let id = editor.view().doc; let doc = &mut editor.documents[id]; diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 3588853ed..04108d794 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -182,7 +182,11 @@ impl Component for Prompt { // char or shift char KeyEvent { code: KeyCode::Char(c), - modifiers: KeyModifiers::NONE | KeyModifiers::SHIFT, + modifiers: KeyModifiers::NONE, + } + | KeyEvent { + code: KeyCode::Char(c), + modifiers: KeyModifiers::SHIFT, } => { self.insert_char(c); (self.callback_fn)(cx.editor, &self.line, PromptEvent::Update);