fix clippy::redundant_clones warnings.

This commit is contained in:
Matthias Krüger 2018-10-26 14:45:25 +02:00
parent 284583fade
commit 68638508d4
2 changed files with 4 additions and 4 deletions

View File

@ -248,7 +248,7 @@ pub fn rewrite_top_level(&self, context: &RewriteContext, shape: Shape) -> Optio
.rewrite(context, shape.offset_left(vis.len())?)
.map(|s| {
if s.is_empty() {
s.to_owned()
s
} else {
format!("{}use {};", vis, s)
}
@ -592,7 +592,7 @@ fn merge_rest(a: &[UseSegment], b: &[UseSegment], len: usize) -> Option<UseSegme
if let UseSegment::List(mut list) = a_rest[0].clone() {
merge_use_trees_inner(&mut list, UseTree::from_path(b_rest.to_vec(), DUMMY_SP));
list.sort();
return Some(UseSegment::List(list.clone()));
return Some(UseSegment::List(list));
}
let mut list = vec![
UseTree::from_path(a_rest.to_vec(), DUMMY_SP),

View File

@ -549,9 +549,9 @@ fn nop_block_collapse(block_str: Option<String>, budget: usize) -> Option<String
&& budget >= 2
&& (block_str[1..].find(|c: char| !c.is_whitespace()).unwrap() == block_str.len() - 2)
{
"{}".to_owned()
String::from("{}")
} else {
block_str.to_owned()
block_str
}
})
}