Format let-else statements
This commit is contained in:
parent
732af201dc
commit
404f76739c
28 changed files with 210 additions and 109 deletions
|
@ -1655,7 +1655,11 @@ impl LspCommand for OnTypeFormatting {
|
|||
type ProtoRequest = proto::OnTypeFormatting;
|
||||
|
||||
fn check_capabilities(&self, server_capabilities: &lsp::ServerCapabilities) -> bool {
|
||||
let Some(on_type_formatting_options) = &server_capabilities.document_on_type_formatting_provider else { return false };
|
||||
let Some(on_type_formatting_options) =
|
||||
&server_capabilities.document_on_type_formatting_provider
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
on_type_formatting_options
|
||||
.first_trigger_character
|
||||
.contains(&self.trigger)
|
||||
|
@ -1769,7 +1773,9 @@ impl LspCommand for OnTypeFormatting {
|
|||
_: ModelHandle<Buffer>,
|
||||
_: AsyncAppContext,
|
||||
) -> Result<Option<Transaction>> {
|
||||
let Some(transaction) = message.transaction else { return Ok(None) };
|
||||
let Some(transaction) = message.transaction else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(Some(language::proto::deserialize_transaction(transaction)?))
|
||||
}
|
||||
|
||||
|
@ -2238,7 +2244,9 @@ impl LspCommand for InlayHints {
|
|||
type ProtoRequest = proto::InlayHints;
|
||||
|
||||
fn check_capabilities(&self, server_capabilities: &lsp::ServerCapabilities) -> bool {
|
||||
let Some(inlay_hint_provider) = &server_capabilities.inlay_hint_provider else { return false };
|
||||
let Some(inlay_hint_provider) = &server_capabilities.inlay_hint_provider else {
|
||||
return false;
|
||||
};
|
||||
match inlay_hint_provider {
|
||||
lsp::OneOf::Left(enabled) => *enabled,
|
||||
lsp::OneOf::Right(inlay_hint_capabilities) => match inlay_hint_capabilities {
|
||||
|
|
|
@ -2317,9 +2317,10 @@ impl BackgroundScannerState {
|
|||
for changed_path in changed_paths {
|
||||
let Some(dot_git_dir) = changed_path
|
||||
.ancestors()
|
||||
.find(|ancestor| ancestor.file_name() == Some(&*DOT_GIT)) else {
|
||||
continue;
|
||||
};
|
||||
.find(|ancestor| ancestor.file_name() == Some(&*DOT_GIT))
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
|
||||
// Avoid processing the same repository multiple times, if multiple paths
|
||||
// within it have changed.
|
||||
|
@ -2348,7 +2349,10 @@ impl BackgroundScannerState {
|
|||
let Some(work_dir) = self
|
||||
.snapshot
|
||||
.entry_for_id(entry_id)
|
||||
.map(|entry| RepositoryWorkDirectory(entry.path.clone())) else { continue };
|
||||
.map(|entry| RepositoryWorkDirectory(entry.path.clone()))
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
|
||||
log::info!("reload git repository {:?}", dot_git_dir);
|
||||
let repository = repository.repo_ptr.lock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue