Skip to content

Commit 5e30df7

Browse files
ltentrupbjorn3
andauthored
Apply suggestions from code review
Co-Authored-By: bjorn3 <[email protected]>
1 parent ac798e1 commit 5e30df7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

crates/ra_ide/src/syntax_highlighting.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub(crate) fn highlight(
194194
let token = sema.descend_into_macros(token.clone());
195195
let parent = token.parent();
196196

197-
// Check if macro takes a format string and remeber it for highlighting later.
197+
// Check if macro takes a format string and remember it for highlighting later.
198198
// The macros that accept a format string expand to a compiler builtin macros
199199
// `format_args` and `format_args_nl`.
200200
if let Some(fmt_macro_call) = parent.parent().and_then(ast::MacroCall::cast) {
@@ -233,8 +233,7 @@ pub(crate) fn highlight(
233233
}
234234
}
235235

236-
let is_format_string =
237-
format_string.as_ref().map(|fs| fs == &element_to_highlight).unwrap_or_default();
236+
let is_format_string = format_string.as_ref() == Some(&element_to_highlight);
238237

239238
if let Some((highlight, binding_hash)) =
240239
highlight_element(&sema, &mut bindings_shadow_count, element_to_highlight.clone())
@@ -245,7 +244,7 @@ pub(crate) fn highlight(
245244
{
246245
stack.push();
247246
if is_format_string {
248-
string.lex_format_specifier(&mut |piece_range, kind| {
247+
string.lex_format_specifier(|piece_range, kind| {
249248
let highlight = match kind {
250249
FormatSpecifier::Open
251250
| FormatSpecifier::Close

crates/ra_syntax/src/ast/tokens.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub enum FormatSpecifier {
192192
}
193193

194194
pub trait HasFormatSpecifier: AstToken {
195-
fn lex_format_specifier<F>(&self, callback: &mut F)
195+
fn lex_format_specifier<F>(&self, mut callback: F)
196196
where
197197
F: FnMut(TextRange, FormatSpecifier),
198198
{

0 commit comments

Comments
 (0)