From 2ae9dfa812ccf18867373f77a106161378a6d91d Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 16 Oct 2018 13:31:16 -0400 Subject: clippy: Fix new_ret_no_self --- crates/ra_editor/src/scope/fn_scope.rs | 4 ++-- crates/ra_editor/src/scope/mod_scope.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/ra_editor/src/scope') diff --git a/crates/ra_editor/src/scope/fn_scope.rs b/crates/ra_editor/src/scope/fn_scope.rs index 9088e5a60..84f036c7e 100644 --- a/crates/ra_editor/src/scope/fn_scope.rs +++ b/crates/ra_editor/src/scope/fn_scope.rs @@ -63,7 +63,7 @@ impl FnScopes { .syntax() .descendants() .filter_map(ast::BindPat::cast) - .filter_map(ScopeEntry::new); + .filter_map(ScopeEntry::new_opt); self.scopes[scope].entries.extend(entries); } fn add_params_bindings(&mut self, scope: ScopeId, params: Option) { @@ -88,7 +88,7 @@ pub struct ScopeEntry { } impl ScopeEntry { - fn new(pat: ast::BindPat) -> Option { + fn new_opt(pat: ast::BindPat) -> Option { if pat.name().is_some() { Some(ScopeEntry { syntax: pat.syntax().owned(), diff --git a/crates/ra_editor/src/scope/mod_scope.rs b/crates/ra_editor/src/scope/mod_scope.rs index 8d7e408f8..956ee0e2f 100644 --- a/crates/ra_editor/src/scope/mod_scope.rs +++ b/crates/ra_editor/src/scope/mod_scope.rs @@ -22,14 +22,14 @@ impl ModuleScope { let mut entries = Vec::new(); for item in items { let entry = match item { - ast::ModuleItem::StructDef(item) => Entry::new(item), - ast::ModuleItem::EnumDef(item) => Entry::new(item), - ast::ModuleItem::FnDef(item) => Entry::new(item), - ast::ModuleItem::ConstDef(item) => Entry::new(item), - ast::ModuleItem::StaticDef(item) => Entry::new(item), - ast::ModuleItem::TraitDef(item) => Entry::new(item), - ast::ModuleItem::TypeDef(item) => Entry::new(item), - ast::ModuleItem::Module(item) => Entry::new(item), + ast::ModuleItem::StructDef(item) => Entry::new_item(item), + ast::ModuleItem::EnumDef(item) => Entry::new_item(item), + ast::ModuleItem::FnDef(item) => Entry::new_item(item), + ast::ModuleItem::ConstDef(item) => Entry::new_item(item), + ast::ModuleItem::StaticDef(item) => Entry::new_item(item), + ast::ModuleItem::TraitDef(item) => Entry::new_item(item), + ast::ModuleItem::TypeDef(item) => Entry::new_item(item), + ast::ModuleItem::Module(item) => Entry::new_item(item), ast::ModuleItem::UseItem(item) => { if let Some(tree) = item.use_tree() { collect_imports(tree, &mut entries); @@ -50,7 +50,7 @@ impl ModuleScope { } impl Entry { - fn new<'a>(item: impl ast::NameOwner<'a>) -> Option { + fn new_item<'a>(item: impl ast::NameOwner<'a>) -> Option { let name = item.name()?; Some(Entry { node: name.syntax().owned(), -- cgit v1.2.3 From 0857c22f263ff18418f939b57a7a2ab3f8aac2c1 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Sat, 20 Oct 2018 12:29:25 -0400 Subject: Revert "clippy: Fix new_ret_no_self" This reverts commit 2ae9dfa812ccf18867373f77a106161378a6d91d. --- crates/ra_editor/src/scope/fn_scope.rs | 4 ++-- crates/ra_editor/src/scope/mod_scope.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/ra_editor/src/scope') diff --git a/crates/ra_editor/src/scope/fn_scope.rs b/crates/ra_editor/src/scope/fn_scope.rs index 84f036c7e..9088e5a60 100644 --- a/crates/ra_editor/src/scope/fn_scope.rs +++ b/crates/ra_editor/src/scope/fn_scope.rs @@ -63,7 +63,7 @@ impl FnScopes { .syntax() .descendants() .filter_map(ast::BindPat::cast) - .filter_map(ScopeEntry::new_opt); + .filter_map(ScopeEntry::new); self.scopes[scope].entries.extend(entries); } fn add_params_bindings(&mut self, scope: ScopeId, params: Option) { @@ -88,7 +88,7 @@ pub struct ScopeEntry { } impl ScopeEntry { - fn new_opt(pat: ast::BindPat) -> Option { + fn new(pat: ast::BindPat) -> Option { if pat.name().is_some() { Some(ScopeEntry { syntax: pat.syntax().owned(), diff --git a/crates/ra_editor/src/scope/mod_scope.rs b/crates/ra_editor/src/scope/mod_scope.rs index 956ee0e2f..8d7e408f8 100644 --- a/crates/ra_editor/src/scope/mod_scope.rs +++ b/crates/ra_editor/src/scope/mod_scope.rs @@ -22,14 +22,14 @@ impl ModuleScope { let mut entries = Vec::new(); for item in items { let entry = match item { - ast::ModuleItem::StructDef(item) => Entry::new_item(item), - ast::ModuleItem::EnumDef(item) => Entry::new_item(item), - ast::ModuleItem::FnDef(item) => Entry::new_item(item), - ast::ModuleItem::ConstDef(item) => Entry::new_item(item), - ast::ModuleItem::StaticDef(item) => Entry::new_item(item), - ast::ModuleItem::TraitDef(item) => Entry::new_item(item), - ast::ModuleItem::TypeDef(item) => Entry::new_item(item), - ast::ModuleItem::Module(item) => Entry::new_item(item), + ast::ModuleItem::StructDef(item) => Entry::new(item), + ast::ModuleItem::EnumDef(item) => Entry::new(item), + ast::ModuleItem::FnDef(item) => Entry::new(item), + ast::ModuleItem::ConstDef(item) => Entry::new(item), + ast::ModuleItem::StaticDef(item) => Entry::new(item), + ast::ModuleItem::TraitDef(item) => Entry::new(item), + ast::ModuleItem::TypeDef(item) => Entry::new(item), + ast::ModuleItem::Module(item) => Entry::new(item), ast::ModuleItem::UseItem(item) => { if let Some(tree) = item.use_tree() { collect_imports(tree, &mut entries); @@ -50,7 +50,7 @@ impl ModuleScope { } impl Entry { - fn new_item<'a>(item: impl ast::NameOwner<'a>) -> Option { + fn new<'a>(item: impl ast::NameOwner<'a>) -> Option { let name = item.name()?; Some(Entry { node: name.syntax().owned(), -- cgit v1.2.3 From dc9ce8ff7494f641c7102785cdef95489f2fc3d6 Mon Sep 17 00:00:00 2001 From: Alan Du Date: Mon, 22 Oct 2018 10:50:55 -0400 Subject: Rename new to new_item (to match new_impl) --- crates/ra_editor/src/scope/mod_scope.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/ra_editor/src/scope') diff --git a/crates/ra_editor/src/scope/mod_scope.rs b/crates/ra_editor/src/scope/mod_scope.rs index 8d7e408f8..956ee0e2f 100644 --- a/crates/ra_editor/src/scope/mod_scope.rs +++ b/crates/ra_editor/src/scope/mod_scope.rs @@ -22,14 +22,14 @@ impl ModuleScope { let mut entries = Vec::new(); for item in items { let entry = match item { - ast::ModuleItem::StructDef(item) => Entry::new(item), - ast::ModuleItem::EnumDef(item) => Entry::new(item), - ast::ModuleItem::FnDef(item) => Entry::new(item), - ast::ModuleItem::ConstDef(item) => Entry::new(item), - ast::ModuleItem::StaticDef(item) => Entry::new(item), - ast::ModuleItem::TraitDef(item) => Entry::new(item), - ast::ModuleItem::TypeDef(item) => Entry::new(item), - ast::ModuleItem::Module(item) => Entry::new(item), + ast::ModuleItem::StructDef(item) => Entry::new_item(item), + ast::ModuleItem::EnumDef(item) => Entry::new_item(item), + ast::ModuleItem::FnDef(item) => Entry::new_item(item), + ast::ModuleItem::ConstDef(item) => Entry::new_item(item), + ast::ModuleItem::StaticDef(item) => Entry::new_item(item), + ast::ModuleItem::TraitDef(item) => Entry::new_item(item), + ast::ModuleItem::TypeDef(item) => Entry::new_item(item), + ast::ModuleItem::Module(item) => Entry::new_item(item), ast::ModuleItem::UseItem(item) => { if let Some(tree) = item.use_tree() { collect_imports(tree, &mut entries); @@ -50,7 +50,7 @@ impl ModuleScope { } impl Entry { - fn new<'a>(item: impl ast::NameOwner<'a>) -> Option { + fn new_item<'a>(item: impl ast::NameOwner<'a>) -> Option { let name = item.name()?; Some(Entry { node: name.syntax().owned(), -- cgit v1.2.3