Drive by lints

This commit is contained in:
kjeremy 2019-09-23 14:31:30 -04:00
parent 5063274959
commit 1808175f98
4 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ pub struct AstEditor<N: AstNode> {
}
impl<N: AstNode> AstEditor<N> {
pub fn new(node: N) -> AstEditor<N>
pub fn new(node: N) -> Self
where
N: Clone,
{

View File

@ -29,7 +29,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As
ctx.add_action(AssistId("fill_match_arms"), "fill match arms", |edit| {
let variants = variant_list.variants();
let arms = variants.into_iter().filter_map(build_pat).map(|pat| {
let arms = variants.filter_map(build_pat).map(|pat| {
AstBuilder::<ast::MatchArm>::from_pieces(
iter::once(pat),
&AstBuilder::<ast::Expr>::unit(),

View File

@ -749,7 +749,7 @@ pub fn data(self, db: &impl HirDatabase) -> Arc<ConstData> {
db.const_data(self)
}
pub fn name(&self, db: &impl HirDatabase) -> Option<Name> {
pub fn name(self, db: &impl HirDatabase) -> Option<Name> {
self.data(db).name().cloned()
}

View File

@ -122,7 +122,7 @@ fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) ->
.fields()
.into_iter()
.flat_map(|it| it.iter())
.map(|(id, _)| StructField { parent: variant_def.clone(), id })
.map(|(id, _)| StructField { parent: variant_def, id })
.find(|f| f.source(db) == src)
}
}