Remove redundant clone

This commit is contained in:
Shotaro Yamada 2018-10-26 03:11:11 +09:00
parent 7b0735a832
commit 3878d24ef6
35 changed files with 56 additions and 65 deletions

View file

@ -84,7 +84,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> {
.into_iter()
.chain(self.get_auto_trait_impl_for(
def_id,
name.clone(),
name,
generics.clone(),
def_ctor,
tcx.require_lang_item(lang_items::SyncTraitLangItem),

View file

@ -66,7 +66,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
}
let ty = self.cx.tcx.type_of(def_id);
let generics = self.cx.tcx.generics_of(def_id);
let real_name = name.clone().map(|name| Ident::from_str(&name));
let real_name = name.map(|name| Ident::from_str(&name));
let param_env = self.cx.tcx.param_env(def_id);
for &trait_def_id in self.cx.all_traits.iter() {
if !self.cx.renderinfo.borrow().access_levels.is_doc_reachable(trait_def_id) ||
@ -109,7 +109,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
);
let may_apply = match infcx.evaluate_obligation(
&traits::Obligation::new(
cause.clone(),
cause,
param_env,
trait_ref.to_predicate(),
),

View file

@ -3611,7 +3611,7 @@ impl ToSource for syntax_pos::Span {
fn to_src(&self, cx: &DocContext) -> String {
debug!("converting span {:?} to snippet", self.clean(cx));
let sn = match cx.sess().source_map().span_to_snippet(*self) {
Ok(x) => x.to_string(),
Ok(x) => x,
Err(_) => String::new()
};
debug!("got snippet {}", sn);

View file

@ -521,7 +521,7 @@ pub fn run(mut krate: clean::Crate,
external_html: external_html.clone(),
krate: krate.name.clone(),
},
css_file_extension: css_file_extension.clone(),
css_file_extension,
created_dirs: Default::default(),
sort_modules_alphabetically,
themes,
@ -1343,7 +1343,7 @@ impl DocFolder for Cache {
self.search_index.push(IndexItem {
ty: item.type_(),
name: s.to_string(),
path: path.join("::").to_string(),
path: path.join("::"),
desc: plain_summary_line(item.doc_value()),
parent,
parent_idx: None,
@ -2283,7 +2283,7 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link
format!("{} [Read more]({})",
&plain_summary_line(Some(s)), naive_assoc_href(item, link))
} else {
plain_summary_line(Some(s)).to_string()
plain_summary_line(Some(s))
};
render_markdown(w, cx, &markdown, item.links(), prefix)?;
} else if !prefix.is_empty() {
@ -2435,7 +2435,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
// (which is the position in the vector).
indices.dedup_by_key(|i| (items[*i].def_id,
if items[*i].name.as_ref().is_some() {
Some(full_path(cx, &items[*i]).clone())
Some(full_path(cx, &items[*i]))
} else {
None
},

View file

@ -460,7 +460,7 @@ fn main_args(args: &[String]) -> isize {
let externs = match parse_externs(&matches) {
Ok(ex) => ex,
Err(err) => {
diag.struct_err(&err.to_string()).emit();
diag.struct_err(&err).emit();
return 1;
}
};

View file

@ -208,7 +208,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
// needs to be the result of SourceMap::span_to_unmapped_path
let input = config::Input::Str {
name: filename.to_owned(),
input: test.to_owned(),
input: test,
};
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);
@ -350,7 +350,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
let newpath = {
let path = env::var_os(var).unwrap_or(OsString::new());
let mut path = env::split_paths(&path).collect::<Vec<_>>();
path.insert(0, libdir.clone());
path.insert(0, libdir);
env::join_paths(path).unwrap()
};
cmd.env(var, &newpath);