mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
cargo clippy --fix
This commit is contained in:
parent
1ab8c7fd27
commit
fad4fa163c
178 changed files with 595 additions and 738 deletions
|
@ -128,7 +128,7 @@ pub(super) fn try_expr(
|
|||
let l = "Propagated as: ".len() - " Type: ".len();
|
||||
let static_text_len_diff = l as isize - s.len() as isize;
|
||||
let tpad = static_text_len_diff.max(0) as usize;
|
||||
let ppad = static_text_len_diff.min(0).abs() as usize;
|
||||
let ppad = static_text_len_diff.min(0).unsigned_abs();
|
||||
|
||||
res.markup = format!(
|
||||
"```text\n{} Type: {:>pad0$}\nPropagated as: {:>pad1$}\n```\n",
|
||||
|
@ -342,7 +342,7 @@ pub(super) fn try_for_lint(attr: &ast::Attr, token: &SyntaxToken) -> Option<Hove
|
|||
tmp = format!("clippy::{}", token.text());
|
||||
&tmp
|
||||
} else {
|
||||
&*token.text()
|
||||
token.text()
|
||||
};
|
||||
|
||||
let lint =
|
||||
|
@ -507,7 +507,7 @@ fn render_notable_trait_comment(
|
|||
format_to!(
|
||||
desc,
|
||||
"{}",
|
||||
assoc_types.into_iter().format_with(", ", |(ty, name), f| {
|
||||
assoc_types.iter().format_with(", ", |(ty, name), f| {
|
||||
f(&name.display(db))?;
|
||||
f(&" = ")?;
|
||||
match ty {
|
||||
|
@ -519,7 +519,7 @@ fn render_notable_trait_comment(
|
|||
desc.push('>');
|
||||
}
|
||||
}
|
||||
desc.is_empty().not().then(|| desc)
|
||||
desc.is_empty().not().then_some(desc)
|
||||
}
|
||||
|
||||
fn type_info(
|
||||
|
@ -635,7 +635,7 @@ fn closure_ty(
|
|||
});
|
||||
|
||||
let adjusted = if let Some(adjusted_ty) = adjusted {
|
||||
walk_and_push_ty(sema.db, &adjusted_ty, &mut push_new_def);
|
||||
walk_and_push_ty(sema.db, adjusted_ty, &mut push_new_def);
|
||||
format!(
|
||||
"\nCoerced to: {}",
|
||||
adjusted_ty.display(sema.db).with_closure_style(hir::ClosureStyle::ImplFn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue