Skip to content

Commit 1d66a67

Browse files
review comment
1 parent 050bc95 commit 1d66a67

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'a> Resolver<'a> {
161161
found_use,
162162
DiagnosticMode::Normal,
163163
path,
164-
None,
164+
"",
165165
);
166166
err.emit();
167167
} else if let Some((span, msg, sugg, appl)) = suggestion {
@@ -691,7 +691,7 @@ impl<'a> Resolver<'a> {
691691
FoundUse::Yes,
692692
DiagnosticMode::Pattern,
693693
vec![],
694-
None,
694+
"",
695695
);
696696
}
697697
err
@@ -1346,7 +1346,7 @@ impl<'a> Resolver<'a> {
13461346
FoundUse::Yes,
13471347
DiagnosticMode::Normal,
13481348
vec![],
1349-
None,
1349+
"",
13501350
);
13511351

13521352
if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) {
@@ -2328,7 +2328,7 @@ pub(crate) fn import_candidates(
23282328
use_placement_span: Option<Span>,
23292329
candidates: &[ImportSuggestion],
23302330
mode: DiagnosticMode,
2331-
append: Option<&str>,
2331+
append: &str,
23322332
) {
23332333
show_candidates(
23342334
session,
@@ -2358,12 +2358,11 @@ fn show_candidates(
23582358
found_use: FoundUse,
23592359
mode: DiagnosticMode,
23602360
path: Vec<Segment>,
2361-
append: Option<&str>,
2361+
append: &str,
23622362
) {
23632363
if candidates.is_empty() {
23642364
return;
23652365
}
2366-
let append = append.unwrap_or("");
23672366

23682367
let mut accessible_path_strings: Vec<(String, &str, Option<DefId>, &Option<String>)> =
23692368
Vec::new();

compiler/rustc_resolve/src/imports.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
554554
Some(err.span),
555555
&candidates,
556556
DiagnosticMode::Import,
557-
(source != target).then(|| format!(" as {target}")).as_deref(),
557+
(source != target)
558+
.then(|| format!(" as {target}"))
559+
.as_deref()
560+
.unwrap_or(""),
558561
),
559562
ImportKind::Single { nested: true, source, target, .. } => {
560563
import_candidates(
@@ -564,7 +567,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
564567
None,
565568
&candidates,
566569
DiagnosticMode::Normal,
567-
(source != target).then(|| format!(" as {target}")).as_deref(),
570+
(source != target)
571+
.then(|| format!(" as {target}"))
572+
.as_deref()
573+
.unwrap_or(""),
568574
);
569575
}
570576
_ => {}

0 commit comments

Comments
 (0)