mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
Remove redundant &
This commit is contained in:
parent
ff0683d666
commit
9fda937779
@ -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(),
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user