mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Fix clippy::single_char_pattern
This commit is contained in:
parent
682bf04bf4
commit
ed3d93b875
4 changed files with 6 additions and 9 deletions
|
@ -57,9 +57,9 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option
|
|||
if text.starts_with("\r\n") {
|
||||
buf.push_str("\r\n");
|
||||
buf.push_str(text.trim_start_matches("\r\n"));
|
||||
} else if text.starts_with("\n") {
|
||||
} else if text.starts_with('\n') {
|
||||
buf.push_str("\n");
|
||||
buf.push_str(text.trim_start_matches("\n"));
|
||||
buf.push_str(text.trim_start_matches('\n'));
|
||||
} else {
|
||||
buf.push_str(text);
|
||||
}
|
||||
|
|
|
@ -31,11 +31,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) {
|
||||
let body = self.func.body(db);
|
||||
for e in body.exprs() {
|
||||
match e {
|
||||
(id, Expr::StructLit { path, fields, spread }) => {
|
||||
self.validate_struct_literal(id, path, fields, spread, db)
|
||||
}
|
||||
_ => (),
|
||||
if let (id, Expr::StructLit { path, fields, spread }) = e {
|
||||
self.validate_struct_literal(id, path, fields, spread, db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ impl ProjectRoot {
|
|||
})
|
||||
};
|
||||
|
||||
let hidden = dir_path.components().any(|c| c.as_str().starts_with("."));
|
||||
let hidden = dir_path.components().any(|c| c.as_str().starts_with('.'));
|
||||
|
||||
!is_ignored && !hidden
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ impl ast::Attr {
|
|||
if attr.kind() == IDENT {
|
||||
let key = attr.as_token()?.text().clone();
|
||||
let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?;
|
||||
let val = val_node.as_token()?.text().trim_start_matches("\"").trim_end_matches("\"");
|
||||
let val = val_node.as_token()?.text().trim_start_matches('"').trim_end_matches('"');
|
||||
Some((key, SmolStr::new(val)))
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue