Skip to content

Commit bbd7ce6

Browse files
committed
couple of clippy::perf fixes
1 parent 0d13f6a commit bbd7ce6

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs

-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(
372372

373373
// Build the type node for each field.
374374
let variant_field_infos: SmallVec<VariantFieldInfo<'ll>> = variant_range
375-
.clone()
376375
.map(|variant_index| {
377376
let variant_struct_type_di_node = super::build_generator_variant_struct_type_di_node(
378377
cx,

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ impl HandlerInner {
12081208
(0, 0) => return,
12091209
(0, _) => self.emitter.emit_diagnostic(&Diagnostic::new(
12101210
Level::Warning,
1211-
DiagnosticMessage::Str(warnings.to_owned()),
1211+
DiagnosticMessage::Str(warnings),
12121212
)),
12131213
(_, 0) => {
12141214
let _ = self.fatal(&errors);

compiler/rustc_expand/src/mbe/macro_parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl TtParser {
589589
(_, 0) => {
590590
// Dump all possible `next_mps` into `cur_mps` for the next iteration. Then
591591
// process the next token.
592-
self.cur_mps.extend(self.next_mps.drain(..));
592+
self.cur_mps.append(&mut self.next_mps);
593593
parser.to_mut().bump();
594594
}
595595

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ fn non_exhaustive_match<'p, 'tcx>(
844844
format!(
845845
"{}{}{} => todo!()",
846846
comma,
847-
snippet.strip_prefix(",").unwrap_or(&snippet),
847+
snippet.strip_prefix(',').unwrap_or(&snippet),
848848
pattern
849849
),
850850
));

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2724,9 +2724,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
27242724
&format!(
27252725
"consider annotating `{}` with `#[derive({})]`",
27262726
trait_pred.skip_binder().self_ty(),
2727-
diagnostic_name.to_string(),
2727+
diagnostic_name,
27282728
),
2729-
format!("#[derive({})]\n", diagnostic_name.to_string()),
2729+
format!("#[derive({})]\n", diagnostic_name),
27302730
Applicability::MaybeIncorrect,
27312731
);
27322732
}

src/librustdoc/passes/html_tags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a, 'tcx> DocVisitor for InvalidHtmlTagsLinter<'a, 'tcx> {
215215
// We don't try to detect stuff `<like, this>` because that's not valid HTML,
216216
// and we don't try to detect stuff `<like this>` because that's not valid Rust.
217217
if let Some(Some(generics_start)) = (is_open_tag
218-
&& dox[..range.end].ends_with(">"))
218+
&& dox[..range.end].ends_with('>'))
219219
.then(|| extract_path_backwards(&dox, range.start))
220220
{
221221
let generics_sp = match super::source_span_for_markdown_range(

0 commit comments

Comments
 (0)