use push(char) instead of push_str(&str) to add single chars to strings
clippy::single-char-push-str
This commit is contained in:
parent
e11c667e4a
commit
9bb10cc907
11 changed files with 31 additions and 29 deletions
|
@ -150,8 +150,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
Some(mut descr) => {
|
||||
// Surround descr with `backticks`.
|
||||
descr.reserve(2);
|
||||
descr.insert_str(0, "`");
|
||||
descr.push_str("`");
|
||||
descr.insert(0, '`');
|
||||
descr.push('`');
|
||||
descr
|
||||
}
|
||||
None => "value".to_string(),
|
||||
|
@ -222,7 +222,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
if self.upvars[var_index].by_ref {
|
||||
buf.push_str(&name);
|
||||
} else {
|
||||
buf.push_str(&format!("*{}", &name));
|
||||
buf.push('*');
|
||||
buf.push_str(&name);
|
||||
}
|
||||
} else {
|
||||
if autoderef {
|
||||
|
@ -234,7 +235,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
&including_downcast,
|
||||
)?;
|
||||
} else {
|
||||
buf.push_str(&"*");
|
||||
buf.push('*');
|
||||
self.append_place_to_string(
|
||||
PlaceRef { local, projection: proj_base },
|
||||
buf,
|
||||
|
@ -272,7 +273,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
autoderef,
|
||||
&including_downcast,
|
||||
)?;
|
||||
buf.push_str(&format!(".{}", field_name));
|
||||
buf.push('.');
|
||||
buf.push_str(&field_name);
|
||||
}
|
||||
}
|
||||
ProjectionElem::Index(index) => {
|
||||
|
@ -284,11 +286,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
autoderef,
|
||||
&including_downcast,
|
||||
)?;
|
||||
buf.push_str("[");
|
||||
buf.push('[');
|
||||
if self.append_local_to_string(*index, buf).is_err() {
|
||||
buf.push_str("_");
|
||||
buf.push('_');
|
||||
}
|
||||
buf.push_str("]");
|
||||
buf.push(']');
|
||||
}
|
||||
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
|
||||
autoderef = true;
|
||||
|
@ -301,7 +303,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
autoderef,
|
||||
&including_downcast,
|
||||
)?;
|
||||
buf.push_str(&"[..]");
|
||||
buf.push_str("[..]");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -648,7 +650,7 @@ impl UseSpans {
|
|||
" in closure".to_string()
|
||||
}
|
||||
}
|
||||
_ => "".to_string(),
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ crate fn location_set_str(
|
|||
|
||||
fn region_value_str(elements: impl IntoIterator<Item = RegionElement>) -> String {
|
||||
let mut result = String::new();
|
||||
result.push_str("{");
|
||||
result.push('{');
|
||||
|
||||
// Set to Some(l1, l2) when we have observed all the locations
|
||||
// from l1..=l2 (inclusive) but not yet printed them. This
|
||||
|
@ -478,7 +478,7 @@ fn region_value_str(elements: impl IntoIterator<Item = RegionElement>) -> String
|
|||
push_location_range(&mut result, location1, location2);
|
||||
}
|
||||
|
||||
result.push_str("}");
|
||||
result.push('}');
|
||||
|
||||
return result;
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ fn collect_and_partition_mono_items<'tcx>(
|
|||
cgus.sort_by_key(|(name, _)| *name);
|
||||
cgus.dedup();
|
||||
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
|
||||
output.push_str(" ");
|
||||
output.push(' ');
|
||||
output.push_str(&cgu_name.as_str());
|
||||
|
||||
let linkage_abbrev = match linkage {
|
||||
|
@ -399,9 +399,9 @@ fn collect_and_partition_mono_items<'tcx>(
|
|||
Linkage::Common => "Common",
|
||||
};
|
||||
|
||||
output.push_str("[");
|
||||
output.push('[');
|
||||
output.push_str(linkage_abbrev);
|
||||
output.push_str("]");
|
||||
output.push(']');
|
||||
}
|
||||
output
|
||||
})
|
||||
|
|
|
@ -514,7 +514,7 @@ fn write_scope_tree(
|
|||
write!(indented_decl, " as {:?}", user_ty).unwrap();
|
||||
}
|
||||
}
|
||||
indented_decl.push_str(";");
|
||||
indented_decl.push(';');
|
||||
|
||||
let local_name =
|
||||
if local == RETURN_PLACE { " return place".to_string() } else { String::new() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue