diff options
| author | klensy <klensy@users.noreply.github.com> | 2023-11-28 14:40:24 +0300 | 
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2023-11-28 14:52:21 +0300 | 
| commit | de13a3871d3dabded59a8c434e800647ac011465 (patch) | |
| tree | 73e4f31ff0959b88e64942e11c1c7bf013871deb /compiler/rustc_builtin_macros/src/format.rs | |
| parent | e06c94d6cb61ef2fa28370fb69a8d2e11b6678c4 (diff) | |
| download | rust-de13a3871d3dabded59a8c434e800647ac011465.tar.gz rust-de13a3871d3dabded59a8c434e800647ac011465.zip | |
unwrap return Option value, as it always returns Some for some fns
Diffstat (limited to 'compiler/rustc_builtin_macros/src/format.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/format.rs | 24 | 
1 files changed, 8 insertions, 16 deletions
| diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 12d12d5bff0..c5fd535b036 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -672,30 +672,22 @@ fn report_missing_placeholders( if explained.contains(&sub) { continue; } - explained.insert(sub.clone()); + explained.insert(sub); if !found_foreign { found_foreign = true; show_doc_note = true; } - if let Some(inner_sp) = pos { - let sp = fmt_span.from_inner(inner_sp); + let sp = fmt_span.from_inner(pos); - if success { - suggestions.push((sp, trn)); - } else { - diag.span_note( - sp, - format!("format specifiers use curly braces, and {}", trn), - ); - } + if success { + suggestions.push((sp, trn)); } else { - if success { - diag.help(format!("`{}` should be written as `{}`", sub, trn)); - } else { - diag.note(format!("`{}` should use curly braces, and {}", sub, trn)); - } + diag.span_note( + sp, + format!("format specifiers use curly braces, and {}", trn), + ); } } | 
