Skip to content

Commit

Permalink
Remove unnecessary .clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Jun 15, 2019
1 parent 165842b commit 6a0abd6
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {

let required_region_bounds = tcx.required_region_bounds(
opaque_type,
bounds.predicates.clone(),
bounds.predicates,
);
debug_assert!(!required_region_bounds.is_empty());

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
self.ir.tcx.lint_hir_note(
lint::builtin::UNUSED_VARIABLES,
hir_id,
spans.clone(),
spans,
&format!("variable `{}` is assigned to, but never used", name),
&format!("consider using `_{}` instead", name),
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<
return match helper(loan_path) {
Some(new_loan_path) => new_loan_path,
None => loan_path.clone()
None => loan_path,
};

fn helper<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> Option<&'a LoanPath<'tcx>> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
}
}));
serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| {
(buffer, CString::new(wp.cgu_name.clone()).unwrap())
(buffer, CString::new(wp.cgu_name).unwrap())
}));

// For all serialized bitcode files we parse them and link them in as we did
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ impl CodegenCx<'b, 'tcx> {
};
let f = self.declare_cfn(name, fn_ty);
llvm::SetUnnamedAddr(f, false);
self.intrinsics.borrow_mut().insert(name, f.clone());
self.intrinsics.borrow_mut().insert(name, f);
f
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ impl<'tcx> VariantInfo<'tcx> {
// with every variant, make each variant name be just the value
// of the discriminant. The struct name for the variant includes
// the actual variant description.
format!("{}", variant_index.as_usize()).to_string()
format!("{}", variant_index.as_usize())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/annotate_snippet_emitter_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl AnnotateSnippetEmitterWriter {
let converter = DiagnosticConverter {
source_map: self.source_map.clone(),
level: level.clone(),
message: message.clone(),
message,
code: code.clone(),
msp: msp.clone(),
children,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<'a> CrateLoader<'a> {
let host_lib = host_lib.unwrap();
self.load_derive_macros(
&host_lib.metadata.get_root(),
host_lib.dylib.clone().map(|p| p.0),
host_lib.dylib.map(|p| p.0),
span
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
pat_span,
}))),
};
let for_arm_body = self.local_decls.push(local.clone());
let for_arm_body = self.local_decls.push(local);
let locals = if has_guard.0 {
let ref_for_guard = self.local_decls.push(LocalDecl::<'tcx> {
// This variable isn't mutated but has a name, so has to be
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ fn receiver_is_valid<'fcx, 'tcx>(
};

let obligation = traits::Obligation::new(
cause.clone(),
cause,
fcx.param_env,
trait_ref.to_predicate()
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
// Ensure that rustdoc works even if rustc is feature-staged
unstable_features: UnstableFeatures::Allow,
actually_rustdoc: true,
debugging_opts: debugging_options.clone(),
debugging_opts: debugging_options,
error_format,
edition,
describe_lints,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ impl Tester for Collector {
debug!("Creating test {}: {}", name, test);
self.tests.push(testing::TestDescAndFn {
desc: testing::TestDesc {
name: testing::DynTestName(name.clone()),
name: testing::DynTestName(name),
ignore: config.ignore,
// compiler failures are test failures
should_panic: testing::ShouldPanic::No,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax_ext/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt<'_>,
};

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

let mut unverified_pieces = Vec::new();
while let Some(piece) = parser.next() {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax_ext/proc_macro_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ impl server::TokenStream for Rustc<'_> {
}
fn from_str(&mut self, src: &str) -> Self::TokenStream {
parse::parse_stream_from_source_str(
FileName::proc_macro_source_code(src.clone()),
FileName::proc_macro_source_code(src),
src.to_string(),
self.sess,
Some(self.call_site),
Expand Down

0 comments on commit 6a0abd6

Please sign in to comment.