about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2021-12-27 14:10:59 -0800
committerMichael Goulet <michael@errs.io>2021-12-27 23:34:52 -0800
commite37d012a0629a20ea9a79efc8434d636f37487d9 (patch)
tree2737a79d8a0ac80682f7f6311008c50e6d965ce8 /compiler/rustc_resolve/src/late
parent51e8031e14a899477a5e2d78ce461cab31123354 (diff)
downloadrust-e37d012a0629a20ea9a79efc8434d636f37487d9.tar.gz
rust-e37d012a0629a20ea9a79efc8434d636f37487d9.zip
Tighten span when suggesting lifetime on path
Diffstat (limited to 'compiler/rustc_resolve/src/late')
-rw-r--r--compiler/rustc_resolve/src/late/diagnostics.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs
index e74a7a95650..4cd1b34bedc 100644
--- a/compiler/rustc_resolve/src/late/diagnostics.rs
+++ b/compiler/rustc_resolve/src/late/diagnostics.rs
@@ -2115,10 +2115,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
                 let spans_suggs: Vec<_> = formatters
                     .into_iter()
                     .zip(spans_with_counts.iter())
-                    .filter_map(|(fmt, (span, _))| {
-                        if let Some(formatter) = fmt { Some((formatter, span)) } else { None }
+                    .filter_map(|(formatter, (span, _))| {
+                        if let Some(formatter) = formatter {
+                            Some((*span, formatter(name)))
+                        } else {
+                            None
+                        }
                     })
-                    .map(|(formatter, span)| (*span, formatter(name)))
                     .collect();
                 if spans_suggs.is_empty() {
                     // If all the spans come from macros, we cannot extract snippets and then