Use more into_iter
rather than drain(..)
This commit is contained in:
parent
b96fa1a25c
commit
97b1a6146c
6 changed files with 16 additions and 16 deletions
|
@ -981,12 +981,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 };
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue