From 0f9b05b2cb0e49a914037e46642e7d8393192f95 Mon Sep 17 00:00:00 2001 From: Yoav Lavi Date: Tue, 22 Mar 2022 19:27:16 +0100 Subject: [PATCH 1/2] fix redundant collect.join --- compiler/rustc_resolve/src/late/diagnostics.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 1394f4083d0b9..6683e6ba6aa71 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1021,7 +1021,8 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { (Res::Def(DefKind::TyAlias, def_id), PathSource::Trait(_)) => { err.span_label(span, "type aliases cannot be used as traits"); if self.r.session.is_nightly_build() { - let msg = "you might have meant to use `#![feature(trait_alias)]` instead of a \ + let msg = + "you might have meant to use `#![feature(trait_alias)]` instead of a \ `type` alias"; if let Some(span) = self.def_span(def_id) { if let Ok(snip) = self.r.session.source_map().span_to_snippet(span) { @@ -2379,9 +2380,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> { suggs.push(match snippet.as_deref() { Some("&") => Some("&'a ".to_string()), Some("'_") => Some("'a".to_string()), - Some("") => { - Some(std::iter::repeat("'a, ").take(count).collect::>().join("")) - } + Some("") => Some(std::iter::repeat("'a, ").take(count).collect::()), Some("<") => { Some(std::iter::repeat("'a").take(count).collect::>().join(", ")) } From 6eebe901ffa377d58351c9328efa2195eb130a27 Mon Sep 17 00:00:00 2001 From: Yoav Lavi Date: Tue, 22 Mar 2022 19:29:41 +0100 Subject: [PATCH 2/2] revert formatting change --- compiler/rustc_resolve/src/late/diagnostics.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 6683e6ba6aa71..e9f596e3a5ba4 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1021,8 +1021,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { (Res::Def(DefKind::TyAlias, def_id), PathSource::Trait(_)) => { err.span_label(span, "type aliases cannot be used as traits"); if self.r.session.is_nightly_build() { - let msg = - "you might have meant to use `#![feature(trait_alias)]` instead of a \ + let msg = "you might have meant to use `#![feature(trait_alias)]` instead of a \ `type` alias"; if let Some(span) = self.def_span(def_id) { if let Ok(snip) = self.r.session.source_map().span_to_snippet(span) {