diff options
| author | Michael Goulet <michael@errs.io> | 2023-01-09 18:07:34 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-01-09 18:07:34 +0000 |
| commit | 1d66a675bb61c21555dcb848ed7378b6f2848de7 (patch) | |
| tree | 6de2a8db055caa13eef877a3696f91e6c494c9be /compiler | |
| parent | 050bc95ce2b23b034d5f41e5c3a8c6e627dfd52a (diff) | |
| download | rust-1d66a675bb61c21555dcb848ed7378b6f2848de7.tar.gz rust-1d66a675bb61c21555dcb848ed7378b6f2848de7.zip | |
review comment
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 10 |
2 files changed, 13 insertions, 8 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index c8b96aae7a6..7d62d67d64f 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -161,7 +161,7 @@ impl<'a> Resolver<'a> { found_use, DiagnosticMode::Normal, path, - None, + "", ); err.emit(); } else if let Some((span, msg, sugg, appl)) = suggestion { @@ -691,7 +691,7 @@ impl<'a> Resolver<'a> { FoundUse::Yes, DiagnosticMode::Pattern, vec![], - None, + "", ); } err @@ -1346,7 +1346,7 @@ impl<'a> Resolver<'a> { FoundUse::Yes, DiagnosticMode::Normal, vec![], - None, + "", ); if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) { @@ -2328,7 +2328,7 @@ pub(crate) fn import_candidates( use_placement_span: Option<Span>, candidates: &[ImportSuggestion], mode: DiagnosticMode, - append: Option<&str>, + append: &str, ) { show_candidates( session, @@ -2358,12 +2358,11 @@ fn show_candidates( found_use: FoundUse, mode: DiagnosticMode, path: Vec<Segment>, - append: Option<&str>, + append: &str, ) { if candidates.is_empty() { return; } - let append = append.unwrap_or(""); let mut accessible_path_strings: Vec<(String, &str, Option<DefId>, &Option<String>)> = Vec::new(); diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 0a2a737e1a4..00f65ac37b6 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -554,7 +554,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> { Some(err.span), &candidates, DiagnosticMode::Import, - (source != target).then(|| format!(" as {target}")).as_deref(), + (source != target) + .then(|| format!(" as {target}")) + .as_deref() + .unwrap_or(""), ), ImportKind::Single { nested: true, source, target, .. } => { import_candidates( @@ -564,7 +567,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> { None, &candidates, DiagnosticMode::Normal, - (source != target).then(|| format!(" as {target}")).as_deref(), + (source != target) + .then(|| format!(" as {target}")) + .as_deref() + .unwrap_or(""), ); } _ => {} |
