about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-05 09:30:53 +0000
committerbors <bors@rust-lang.org>2022-06-05 09:30:53 +0000
commit4322a785cc99ea5fc81dd7f5fc8ba7f7a64b08ef (patch)
tree4a4a195907d0e90c345e280060c116038fa572a3 /compiler/rustc_errors/src
parenta2da4af33c5e6a22fff0a223f99d53cba4a5aa52 (diff)
parentcae3c78664a2ed901e5e962707960e45e7cea33d (diff)
downloadrust-4322a785cc99ea5fc81dd7f5fc8ba7f7a64b08ef.tar.gz
rust-4322a785cc99ea5fc81dd7f5fc8ba7f7a64b08ef.zip
Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin
Replace `&Vec<_>`s with `&[_]`s

It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`.

I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 643f3c12134..eaceecc1667 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -827,7 +827,7 @@ impl Diagnostic {
         self
     }
 
-    pub fn styled_message(&self) -> &Vec<(DiagnosticMessage, Style)> {
+    pub fn styled_message(&self) -> &[(DiagnosticMessage, Style)] {
         &self.message
     }
 
@@ -888,11 +888,11 @@ impl Diagnostic {
         &self,
     ) -> (
         &Level,
-        &Vec<(DiagnosticMessage, Style)>,
+        &[(DiagnosticMessage, Style)],
         &Option<DiagnosticId>,
         &MultiSpan,
         &Result<Vec<CodeSuggestion>, SuggestionsDisabled>,
-        Option<&Vec<SubDiagnostic>>,
+        Option<&[SubDiagnostic]>,
     ) {
         (
             &self.level,