clippy: Drop or-patterns for now because they're not on stable rust yet

This commit is contained in:
Blaž Hrastnik 2021-04-06 19:45:14 +09:00
parent 91462af546
commit 0e9ecccfc1
3 changed files with 15 additions and 13 deletions

View file

@ -384,13 +384,11 @@ impl Client {
let capabilities = self.capabilities.as_ref().unwrap(); let capabilities = self.capabilities.as_ref().unwrap();
let sync_capabilities = match capabilities.text_document_sync { let sync_capabilities = match capabilities.text_document_sync {
Some( Some(lsp::TextDocumentSyncCapability::Kind(kind))
lsp::TextDocumentSyncCapability::Kind(kind) | Some(lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions {
| lsp::TextDocumentSyncCapability::Options(lsp::TextDocumentSyncOptions { change: Some(kind),
change: Some(kind), ..
.. })) => kind,
}),
) => kind,
// None | SyncOptions { changes: None } // None | SyncOptions { changes: None }
_ => return Ok(()), _ => return Ok(()),
}; };
@ -540,7 +538,7 @@ impl Client {
// check if we're able to format // check if we're able to format
match capabilities.document_formatting_provider { 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) // None | Some(false)
_ => return Ok(Vec::new()), _ => return Ok(Vec::new()),
}; };
@ -569,7 +567,7 @@ impl Client {
// check if we're able to format // check if we're able to format
match capabilities.document_range_formatting_provider { 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) // None | Some(false)
_ => return Ok(Vec::new()), _ => return Ok(Vec::new()),
}; };

View file

@ -821,15 +821,15 @@ pub fn command_mode(cx: &mut Context) {
let parts = input.split_ascii_whitespace().collect::<Vec<&str>>(); let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
match *parts.as_slice() { match *parts.as_slice() {
["q" | "quit"] => { ["q"] | ["quit"] => {
editor.close(editor.view().id); editor.close(editor.view().id);
// editor.should_close = true, // editor.should_close = true,
} }
["o" | "open", path] => { ["o", path] | ["open", path] => {
use helix_view::editor::Action; use helix_view::editor::Action;
editor.open(path.into(), Action::Replace); editor.open(path.into(), Action::Replace);
} }
["w" | "write"] => { ["w"] | ["write"] => {
// TODO: non-blocking via save() command // TODO: non-blocking via save() command
let id = editor.view().doc; let id = editor.view().doc;
let doc = &mut editor.documents[id]; let doc = &mut editor.documents[id];

View file

@ -182,7 +182,11 @@ impl Component for Prompt {
// char or shift char // char or shift char
KeyEvent { KeyEvent {
code: KeyCode::Char(c), 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.insert_char(c);
(self.callback_fn)(cx.editor, &self.line, PromptEvent::Update); (self.callback_fn)(cx.editor, &self.line, PromptEvent::Update);