diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-31 21:30:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-31 21:30:13 +0200 |
| commit | e5356712b9ec90d6a0a38c99aea7e00e471227c5 (patch) | |
| tree | fa1c5fb8ecbd6a056b2a77ff882a717028470942 /compiler/rustc_errors/src | |
| parent | f378155fb6e9b1f22bef53a37fe61a1b21eed545 (diff) | |
| parent | 97b1a6146c630374ddab15f424eb8141dbb88960 (diff) | |
| download | rust-e5356712b9ec90d6a0a38c99aea7e00e471227c5.tar.gz rust-e5356712b9ec90d6a0a38c99aea7e00e471227c5.zip | |
Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillot
Use more `into_iter` rather than `drain(..)` Clearer semantic.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_errors/src/translation.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index f75e2596f36..95ae9765a48 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -974,12 +974,12 @@ impl Diagnostic { fn sub_with_highlights<M: Into<SubdiagnosticMessage>>( &mut self, level: Level, - mut message: Vec<(M, Style)>, + message: Vec<(M, Style)>, span: MultiSpan, render_span: Option<MultiSpan>, ) { let message = message - .drain(..) + .into_iter() .map(|m| (self.subdiagnostic_message_to_diagnostic_message(m.0), m.1)) .collect(); let sub = SubDiagnostic { level, message, span, render_span }; diff --git a/compiler/rustc_errors/src/translation.rs b/compiler/rustc_errors/src/translation.rs index 65338f56d9c..4f407badb3f 100644 --- a/compiler/rustc_errors/src/translation.rs +++ b/compiler/rustc_errors/src/translation.rs @@ -21,7 +21,7 @@ pub trait Translate { /// Typically performed once for each diagnostic at the start of `emit_diagnostic` and then /// passed around as a reference thereafter. fn to_fluent_args<'arg>(&self, args: &[DiagnosticArg<'arg>]) -> FluentArgs<'arg> { - FromIterator::from_iter(args.to_vec().drain(..)) + FromIterator::from_iter(args.iter().cloned()) } /// Convert `DiagnosticMessage`s to a string, performing translation if necessary. |
