diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-03-15 17:46:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 17:46:36 -0400 |
commit | fb021d7ceff3f8b1d7cdb0c2bdd75ea07c0428d2 (patch) | |
tree | 09cb2bf87bba760b1abf706e0b8faedc9c368bbc /cli/lsp/capabilities.rs | |
parent | ca51f4f6c058d16ac438ad75ac92e8954895f5aa (diff) |
refactor: remove usages of `map_or` / `map_or_else` (#18212)
These methods are confusing because the arguments are backwards. I feel
like they should have never been added to `Option<T>` and that clippy
should suggest rewriting to
`map(...).unwrap_or(...)`/`map(...).unwrap_or_else(|| ...)`
https://github.com/rust-lang/rfcs/issues/1025
Diffstat (limited to 'cli/lsp/capabilities.rs')
-rw-r--r-- | cli/lsp/capabilities.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs index 029c5c9a9..e56aa6b87 100644 --- a/cli/lsp/capabilities.rs +++ b/cli/lsp/capabilities.rs @@ -19,7 +19,7 @@ fn code_action_capabilities( .as_ref() .and_then(|it| it.code_action.as_ref()) .and_then(|it| it.code_action_literal_support.as_ref()) - .map_or(CodeActionProviderCapability::Simple(true), |_| { + .map(|_| { let mut code_action_kinds = vec![CodeActionKind::QUICKFIX, CodeActionKind::REFACTOR]; code_action_kinds.extend( @@ -34,6 +34,7 @@ fn code_action_capabilities( work_done_progress_options: Default::default(), }) }) + .unwrap_or(CodeActionProviderCapability::Simple(true)) } pub fn server_capabilities( |