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
|
@ -166,14 +166,14 @@ pub mod printf {
|
||||||
let cap = self.span.len() + if has_options { 2 } else { 0 };
|
let cap = self.span.len() + if has_options { 2 } else { 0 };
|
||||||
let mut s = String::with_capacity(cap);
|
let mut s = String::with_capacity(cap);
|
||||||
|
|
||||||
s.push_str("{");
|
s.push('{');
|
||||||
|
|
||||||
if let Some(arg) = self.parameter {
|
if let Some(arg) = self.parameter {
|
||||||
write!(s, "{}", arg.checked_sub(1)?).ok()?;
|
write!(s, "{}", arg.checked_sub(1)?).ok()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if has_options {
|
if has_options {
|
||||||
s.push_str(":");
|
s.push(':');
|
||||||
|
|
||||||
let align = if let Some(fill) = fill {
|
let align = if let Some(fill) = fill {
|
||||||
s.push_str(fill);
|
s.push_str(fill);
|
||||||
|
@ -191,11 +191,11 @@ pub mod printf {
|
||||||
}
|
}
|
||||||
|
|
||||||
if alt {
|
if alt {
|
||||||
s.push_str("#");
|
s.push('#');
|
||||||
}
|
}
|
||||||
|
|
||||||
if zero_fill {
|
if zero_fill {
|
||||||
s.push_str("0");
|
s.push('0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(width) = width {
|
if let Some(width) = width {
|
||||||
|
@ -203,7 +203,7 @@ pub mod printf {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(precision) = precision {
|
if let Some(precision) = precision {
|
||||||
s.push_str(".");
|
s.push('.');
|
||||||
precision.translate(&mut s).ok()?;
|
precision.translate(&mut s).ok()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ pub mod printf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s.push_str("}");
|
s.push('}');
|
||||||
Some(s)
|
Some(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1076,7 +1076,7 @@ fn exec_linker(
|
||||||
}
|
}
|
||||||
.to_string(),
|
.to_string(),
|
||||||
);
|
);
|
||||||
args.push_str("\n");
|
args.push('\n');
|
||||||
}
|
}
|
||||||
let file = tmpdir.join("linker-arguments");
|
let file = tmpdir.join("linker-arguments");
|
||||||
let bytes = if sess.target.target.options.is_like_msvc {
|
let bytes = if sess.target.target.options.is_like_msvc {
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn push_debuginfo_type_name<'tcx>(
|
||||||
ty::Bool => output.push_str("bool"),
|
ty::Bool => output.push_str("bool"),
|
||||||
ty::Char => output.push_str("char"),
|
ty::Char => output.push_str("char"),
|
||||||
ty::Str => output.push_str("str"),
|
ty::Str => output.push_str("str"),
|
||||||
ty::Never => output.push_str("!"),
|
ty::Never => output.push('!'),
|
||||||
ty::Int(int_ty) => output.push_str(int_ty.name_str()),
|
ty::Int(int_ty) => output.push_str(int_ty.name_str()),
|
||||||
ty::Uint(uint_ty) => output.push_str(uint_ty.name_str()),
|
ty::Uint(uint_ty) => output.push_str(uint_ty.name_str()),
|
||||||
ty::Float(float_ty) => output.push_str(float_ty.name_str()),
|
ty::Float(float_ty) => output.push_str(float_ty.name_str()),
|
||||||
|
|
|
@ -2093,7 +2093,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
_ => String::new(),
|
_ => String::new(),
|
||||||
};
|
};
|
||||||
if !s.is_empty() {
|
if !s.is_empty() {
|
||||||
s.push_str(" ");
|
s.push(' ');
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
};
|
};
|
||||||
|
|
|
@ -150,8 +150,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
Some(mut descr) => {
|
Some(mut descr) => {
|
||||||
// Surround descr with `backticks`.
|
// Surround descr with `backticks`.
|
||||||
descr.reserve(2);
|
descr.reserve(2);
|
||||||
descr.insert_str(0, "`");
|
descr.insert(0, '`');
|
||||||
descr.push_str("`");
|
descr.push('`');
|
||||||
descr
|
descr
|
||||||
}
|
}
|
||||||
None => "value".to_string(),
|
None => "value".to_string(),
|
||||||
|
@ -222,7 +222,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
if self.upvars[var_index].by_ref {
|
if self.upvars[var_index].by_ref {
|
||||||
buf.push_str(&name);
|
buf.push_str(&name);
|
||||||
} else {
|
} else {
|
||||||
buf.push_str(&format!("*{}", &name));
|
buf.push('*');
|
||||||
|
buf.push_str(&name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if autoderef {
|
if autoderef {
|
||||||
|
@ -234,7 +235,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
&including_downcast,
|
&including_downcast,
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
buf.push_str(&"*");
|
buf.push('*');
|
||||||
self.append_place_to_string(
|
self.append_place_to_string(
|
||||||
PlaceRef { local, projection: proj_base },
|
PlaceRef { local, projection: proj_base },
|
||||||
buf,
|
buf,
|
||||||
|
@ -272,7 +273,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
autoderef,
|
autoderef,
|
||||||
&including_downcast,
|
&including_downcast,
|
||||||
)?;
|
)?;
|
||||||
buf.push_str(&format!(".{}", field_name));
|
buf.push('.');
|
||||||
|
buf.push_str(&field_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ProjectionElem::Index(index) => {
|
ProjectionElem::Index(index) => {
|
||||||
|
@ -284,11 +286,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
autoderef,
|
autoderef,
|
||||||
&including_downcast,
|
&including_downcast,
|
||||||
)?;
|
)?;
|
||||||
buf.push_str("[");
|
buf.push('[');
|
||||||
if self.append_local_to_string(*index, buf).is_err() {
|
if self.append_local_to_string(*index, buf).is_err() {
|
||||||
buf.push_str("_");
|
buf.push('_');
|
||||||
}
|
}
|
||||||
buf.push_str("]");
|
buf.push(']');
|
||||||
}
|
}
|
||||||
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
|
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
|
||||||
autoderef = true;
|
autoderef = true;
|
||||||
|
@ -301,7 +303,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
autoderef,
|
autoderef,
|
||||||
&including_downcast,
|
&including_downcast,
|
||||||
)?;
|
)?;
|
||||||
buf.push_str(&"[..]");
|
buf.push_str("[..]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -648,7 +650,7 @@ impl UseSpans {
|
||||||
" in closure".to_string()
|
" 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 {
|
fn region_value_str(elements: impl IntoIterator<Item = RegionElement>) -> String {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
result.push_str("{");
|
result.push('{');
|
||||||
|
|
||||||
// Set to Some(l1, l2) when we have observed all the locations
|
// Set to Some(l1, l2) when we have observed all the locations
|
||||||
// from l1..=l2 (inclusive) but not yet printed them. This
|
// 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);
|
push_location_range(&mut result, location1, location2);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push_str("}");
|
result.push('}');
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ fn collect_and_partition_mono_items<'tcx>(
|
||||||
cgus.sort_by_key(|(name, _)| *name);
|
cgus.sort_by_key(|(name, _)| *name);
|
||||||
cgus.dedup();
|
cgus.dedup();
|
||||||
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
|
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
|
||||||
output.push_str(" ");
|
output.push(' ');
|
||||||
output.push_str(&cgu_name.as_str());
|
output.push_str(&cgu_name.as_str());
|
||||||
|
|
||||||
let linkage_abbrev = match linkage {
|
let linkage_abbrev = match linkage {
|
||||||
|
@ -399,9 +399,9 @@ fn collect_and_partition_mono_items<'tcx>(
|
||||||
Linkage::Common => "Common",
|
Linkage::Common => "Common",
|
||||||
};
|
};
|
||||||
|
|
||||||
output.push_str("[");
|
output.push('[');
|
||||||
output.push_str(linkage_abbrev);
|
output.push_str(linkage_abbrev);
|
||||||
output.push_str("]");
|
output.push(']');
|
||||||
}
|
}
|
||||||
output
|
output
|
||||||
})
|
})
|
||||||
|
|
|
@ -514,7 +514,7 @@ fn write_scope_tree(
|
||||||
write!(indented_decl, " as {:?}", user_ty).unwrap();
|
write!(indented_decl, " as {:?}", user_ty).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
indented_decl.push_str(";");
|
indented_decl.push(';');
|
||||||
|
|
||||||
let local_name =
|
let local_name =
|
||||||
if local == RETURN_PLACE { " return place".to_string() } else { String::new() };
|
if local == RETURN_PLACE { " return place".to_string() } else { String::new() };
|
||||||
|
|
|
@ -438,7 +438,7 @@ impl<'tcx> SaveContext<'tcx> {
|
||||||
.next()
|
.next()
|
||||||
.map(|item| item.def_id);
|
.map(|item| item.def_id);
|
||||||
}
|
}
|
||||||
qualname.push_str(">");
|
qualname.push('>');
|
||||||
|
|
||||||
(qualname, trait_id, decl_id, docs, attrs)
|
(qualname, trait_id, decl_id, docs, attrs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,7 +497,7 @@ impl<'hir> Sig for hir::Item<'hir> {
|
||||||
sig.text.push_str(&bounds_to_string(bounds));
|
sig.text.push_str(&bounds_to_string(bounds));
|
||||||
}
|
}
|
||||||
// FIXME where clause
|
// FIXME where clause
|
||||||
sig.text.push_str(";");
|
sig.text.push(';');
|
||||||
|
|
||||||
Ok(sig)
|
Ok(sig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -581,9 +581,9 @@ impl OutputFilenames {
|
||||||
|
|
||||||
if !ext.is_empty() {
|
if !ext.is_empty() {
|
||||||
if !extension.is_empty() {
|
if !extension.is_empty() {
|
||||||
extension.push_str(".");
|
extension.push('.');
|
||||||
extension.push_str(RUST_CGU_EXT);
|
extension.push_str(RUST_CGU_EXT);
|
||||||
extension.push_str(".");
|
extension.push('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
extension.push_str(ext);
|
extension.push_str(ext);
|
||||||
|
|
Loading…
Reference in New Issue