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") {
|
if text.starts_with("\r\n") {
|
||||||
buf.push_str("\r\n");
|
buf.push_str("\r\n");
|
||||||
buf.push_str(text.trim_start_matches("\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("\n");
|
||||||
buf.push_str(text.trim_start_matches("\n"));
|
buf.push_str(text.trim_start_matches('\n'));
|
||||||
} else {
|
} else {
|
||||||
buf.push_str(text);
|
buf.push_str(text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
||||||
pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) {
|
pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) {
|
||||||
let body = self.func.body(db);
|
let body = self.func.body(db);
|
||||||
for e in body.exprs() {
|
for e in body.exprs() {
|
||||||
match e {
|
if let (id, Expr::StructLit { path, fields, spread }) = e {
|
||||||
(id, Expr::StructLit { path, fields, spread }) => {
|
self.validate_struct_literal(id, path, fields, spread, db);
|
||||||
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
|
!is_ignored && !hidden
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ impl ast::Attr {
|
||||||
if attr.kind() == IDENT {
|
if attr.kind() == IDENT {
|
||||||
let key = attr.as_token()?.text().clone();
|
let key = attr.as_token()?.text().clone();
|
||||||
let val_node = tt_node.children_with_tokens().find(|t| t.kind() == STRING)?;
|
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)))
|
Some((key, SmolStr::new(val)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Loading…
Add table
Reference in a new issue