use chars instead of strings where applicable

This commit is contained in:
Matthias Krüger 2023-02-15 22:44:51 +01:00
parent 2d14db321b
commit 0400c68517
2 changed files with 4 additions and 4 deletions

View File

@ -344,7 +344,7 @@ fn preprocess_link(link: &str) -> String {
let link = link.strip_suffix("()").unwrap_or(link); let link = link.strip_suffix("()").unwrap_or(link);
let link = link.strip_suffix("{}").unwrap_or(link); let link = link.strip_suffix("{}").unwrap_or(link);
let link = link.strip_suffix("[]").unwrap_or(link); let link = link.strip_suffix("[]").unwrap_or(link);
let link = if link != "!" { link.strip_suffix("!").unwrap_or(link) } else { link }; let link = if link != "!" { link.strip_suffix('!').unwrap_or(link) } else { link };
strip_generics_from_path(link).unwrap_or_else(|_| link.to_string()) strip_generics_from_path(link).unwrap_or_else(|_| link.to_string())
} }

View File

@ -361,7 +361,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
for _ in 0..padding_amout { for _ in 0..padding_amout {
br_with_padding.push_str(" "); br_with_padding.push_str(" ");
} }
let where_preds = where_preds.to_string().replace("\n", &br_with_padding); let where_preds = where_preds.to_string().replace('\n', &br_with_padding);
if ending == Ending::Newline { if ending == Ending::Newline {
let mut clause = " ".repeat(indent.saturating_sub(1)); let mut clause = " ".repeat(indent.saturating_sub(1));
@ -1421,12 +1421,12 @@ impl clean::FnDecl {
format!( format!(
"({pad}{args}{close}){arrow}", "({pad}{args}{close}){arrow}",
pad = if self.inputs.values.is_empty() { "" } else { &full_pad }, pad = if self.inputs.values.is_empty() { "" } else { &full_pad },
args = args.replace("\n", &full_pad), args = args.replace('\n', &full_pad),
close = close_pad, close = close_pad,
arrow = arrow arrow = arrow
) )
} else { } else {
format!("({args}){arrow}", args = args.replace("\n", " "), arrow = arrow) format!("({args}){arrow}", args = args.replace('\n', " "), arrow = arrow)
}; };
write!(f, "{}", output) write!(f, "{}", output)