mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-17 09:00:25 +00:00
Replace if let
with match
where appropriate
This commit is contained in:
parent
f29796da61
commit
9583dd5725
44 changed files with 201 additions and 269 deletions
|
@ -283,10 +283,9 @@ pub trait HasFormatSpecifier: AstToken {
|
|||
where
|
||||
F: FnMut(TextRange, FormatSpecifier),
|
||||
{
|
||||
let char_ranges = if let Some(char_ranges) = self.char_ranges() {
|
||||
char_ranges
|
||||
} else {
|
||||
return;
|
||||
let char_ranges = match self.char_ranges() {
|
||||
Some(char_ranges) => char_ranges,
|
||||
None => return,
|
||||
};
|
||||
let mut chars = char_ranges.iter().peekable();
|
||||
|
||||
|
@ -528,10 +527,11 @@ pub trait HasFormatSpecifier: AstToken {
|
|||
}
|
||||
}
|
||||
|
||||
if let Some((_, Ok('}'))) = chars.peek() {
|
||||
skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback);
|
||||
} else {
|
||||
continue;
|
||||
match chars.peek() {
|
||||
Some((_, Ok('}'))) => {
|
||||
skip_char_and_emit(&mut chars, FormatSpecifier::Close, &mut callback);
|
||||
}
|
||||
Some((_, _)) | None => continue,
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue