From 9fda93777965f0023d055c947e8f2dc301dbc62f Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Fri, 29 Mar 2019 19:17:50 +0900 Subject: [PATCH] Remove redundant & --- src/comment.rs | 4 ++-- src/expr.rs | 2 +- src/items.rs | 8 ++++---- src/test/mod.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/comment.rs b/src/comment.rs index 83ec810381e..87c6b65865b 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -591,7 +591,7 @@ impl<'a> CommentRewrite<'a> { ) { Some(s) => self.result.push_str(&Self::join_block( &s, - &format!("{}{}", &self.comment_line_separator, ib.line_start), + &format!("{}{}", self.comment_line_separator, ib.line_start), )), None => self.result.push_str(&Self::join_block( &ib.original_block_as_string(), @@ -634,7 +634,7 @@ impl<'a> CommentRewrite<'a> { ) { Some(s) => self.result.push_str(&Self::join_block( &s, - &format!("{}{}", &self.comment_line_separator, ib.line_start), + &format!("{}{}", self.comment_line_separator, ib.line_start), )), None => self.result.push_str(&Self::join_block( &ib.original_block_as_string(), diff --git a/src/expr.rs b/src/expr.rs index 11a7767d37c..8d241dff1f9 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1459,7 +1459,7 @@ fn rewrite_paren( let subexpr_str = subexpr.rewrite(context, sub_shape)?; let fits_single_line = !pre_comment.contains("//") && !post_comment.contains("//"); if fits_single_line { - Some(format!("({}{}{})", pre_comment, &subexpr_str, post_comment)) + Some(format!("({}{}{})", pre_comment, subexpr_str, post_comment)) } else { rewrite_paren_in_multi_line(context, subexpr, shape, pre_span, post_span) } diff --git a/src/items.rs b/src/items.rs index 8cd6010f72f..1647ecfcc3b 100644 --- a/src/items.rs +++ b/src/items.rs @@ -730,7 +730,7 @@ pub fn format_impl( if generics.where_clause.predicates.len() == 1 { result.push_str(","); } - result.push_str(&format!("{}{{{}}}", &sep, &sep)); + result.push_str(&format!("{}{{{}}}", sep, sep)); } else { result.push_str(" {}"); } @@ -912,7 +912,7 @@ fn rewrite_trait_ref( let shape = Shape::indented(offset + used_space, context.config); if let Some(trait_ref_str) = trait_ref.rewrite(context, shape) { if !trait_ref_str.contains('\n') { - return Some(format!(" {}{}", polarity_str, &trait_ref_str)); + return Some(format!(" {}{}", polarity_str, trait_ref_str)); } } // We could not make enough space for trait_ref, so put it on new line. @@ -921,9 +921,9 @@ fn rewrite_trait_ref( let trait_ref_str = trait_ref.rewrite(context, shape)?; Some(format!( "{}{}{}", - &offset.to_string_with_newline(context.config), + offset.to_string_with_newline(context.config), polarity_str, - &trait_ref_str + trait_ref_str )) } diff --git a/src/test/mod.rs b/src/test/mod.rs index fc25d27b531..dc297a52dfb 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -609,11 +609,11 @@ fn handle_result( for (file_name, fmt_text) in result { // If file is in tests/source, compare to file with same name in tests/target. let target = get_target(&file_name, target); - let open_error = format!("couldn't open target {:?}", &target); + let open_error = format!("couldn't open target {:?}", target); let mut f = fs::File::open(&target).expect(&open_error); let mut text = String::new(); - let read_error = format!("failed reading target {:?}", &target); + let read_error = format!("failed reading target {:?}", target); f.read_to_string(&mut text).expect(&read_error); // Ignore LF and CRLF difference for Windows.