Skip to content

Commit 6a0abd6

Browse files
committed
Remove unnecessary .clone()
1 parent 165842b commit 6a0abd6

File tree

14 files changed

+14
-14
lines changed

14 files changed

+14
-14
lines changed

src/librustc/infer/opaque_types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
307307

308308
let required_region_bounds = tcx.required_region_bounds(
309309
opaque_type,
310-
bounds.predicates.clone(),
310+
bounds.predicates,
311311
);
312312
debug_assert!(!required_region_bounds.is_empty());
313313

src/librustc/middle/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
16171617
self.ir.tcx.lint_hir_note(
16181618
lint::builtin::UNUSED_VARIABLES,
16191619
hir_id,
1620-
spans.clone(),
1620+
spans,
16211621
&format!("variable `{}` is assigned to, but never used", name),
16221622
&format!("consider using `_{}` instead", name),
16231623
);

src/librustc_borrowck/borrowck/check_loans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<
3636
3737
return match helper(loan_path) {
3838
Some(new_loan_path) => new_loan_path,
39-
None => loan_path.clone()
39+
None => loan_path,
4040
};
4141

4242
fn helper<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> Option<&'a LoanPath<'tcx>> {

src/librustc_codegen_llvm/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
279279
}
280280
}));
281281
serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| {
282-
(buffer, CString::new(wp.cgu_name.clone()).unwrap())
282+
(buffer, CString::new(wp.cgu_name).unwrap())
283283
}));
284284

285285
// For all serialized bitcode files we parse them and link them in as we did

src/librustc_codegen_llvm/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl CodegenCx<'b, 'tcx> {
459459
};
460460
let f = self.declare_cfn(name, fn_ty);
461461
llvm::SetUnnamedAddr(f, false);
462-
self.intrinsics.borrow_mut().insert(name, f.clone());
462+
self.intrinsics.borrow_mut().insert(name, f);
463463
f
464464
}
465465

src/librustc_codegen_llvm/debuginfo/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ impl<'tcx> VariantInfo<'tcx> {
16091609
// with every variant, make each variant name be just the value
16101610
// of the discriminant. The struct name for the variant includes
16111611
// the actual variant description.
1612-
format!("{}", variant_index.as_usize()).to_string()
1612+
format!("{}", variant_index.as_usize())
16131613
}
16141614
}
16151615
}

src/librustc_errors/annotate_snippet_emitter_writer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl AnnotateSnippetEmitterWriter {
194194
let converter = DiagnosticConverter {
195195
source_map: self.source_map.clone(),
196196
level: level.clone(),
197-
message: message.clone(),
197+
message,
198198
code: code.clone(),
199199
msp: msp.clone(),
200200
children,

src/librustc_metadata/creader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'a> CrateLoader<'a> {
236236
let host_lib = host_lib.unwrap();
237237
self.load_derive_macros(
238238
&host_lib.metadata.get_root(),
239-
host_lib.dylib.clone().map(|p| p.0),
239+
host_lib.dylib.map(|p| p.0),
240240
span
241241
)
242242
} else {

src/librustc_mir/build/matches/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
17371737
pat_span,
17381738
}))),
17391739
};
1740-
let for_arm_body = self.local_decls.push(local.clone());
1740+
let for_arm_body = self.local_decls.push(local);
17411741
let locals = if has_guard.0 {
17421742
let ref_for_guard = self.local_decls.push(LocalDecl::<'tcx> {
17431743
// This variable isn't mutated but has a name, so has to be

src/librustc_typeck/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ fn receiver_is_valid<'fcx, 'tcx>(
922922
};
923923

924924
let obligation = traits::Obligation::new(
925-
cause.clone(),
925+
cause,
926926
fcx.param_env,
927927
trait_ref.to_predicate()
928928
);

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
317317
// Ensure that rustdoc works even if rustc is feature-staged
318318
unstable_features: UnstableFeatures::Allow,
319319
actually_rustdoc: true,
320-
debugging_opts: debugging_options.clone(),
320+
debugging_opts: debugging_options,
321321
error_format,
322322
edition,
323323
describe_lints,

src/librustdoc/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ impl Tester for Collector {
740740
debug!("Creating test {}: {}", name, test);
741741
self.tests.push(testing::TestDescAndFn {
742742
desc: testing::TestDesc {
743-
name: testing::DynTestName(name.clone()),
743+
name: testing::DynTestName(name),
744744
ignore: config.ignore,
745745
// compiler failures are test failures
746746
should_panic: testing::ShouldPanic::No,

src/libsyntax_ext/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt<'_>,
887887
};
888888

889889
let fmt_str = &*fmt.node.0.as_str(); // for the suggestions below
890-
let mut parser = parse::Parser::new(fmt_str, str_style, skips.clone(), append_newline);
890+
let mut parser = parse::Parser::new(fmt_str, str_style, skips, append_newline);
891891

892892
let mut unverified_pieces = Vec::new();
893893
while let Some(piece) = parser.next() {

src/libsyntax_ext/proc_macro_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl server::TokenStream for Rustc<'_> {
409409
}
410410
fn from_str(&mut self, src: &str) -> Self::TokenStream {
411411
parse::parse_stream_from_source_str(
412-
FileName::proc_macro_source_code(src.clone()),
412+
FileName::proc_macro_source_code(src),
413413
src.to_string(),
414414
self.sess,
415415
Some(self.call_site),

0 commit comments

Comments
 (0)