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_analysis/src/descriptors.rs | 2 +- crates/ra_analysis/src/imp.rs | 2 +- crates/ra_analysis/src/job.rs | 2 +- crates/ra_analysis/tests/tests.rs | 4 ++-- crates/ra_editor/src/scope/fn_scope.rs | 4 ++-- crates/ra_editor/src/scope/mod_scope.rs | 18 +++++++++--------- crates/ra_lsp_server/src/main_loop/mod.rs | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'crates') diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index dced99b07..3fca3e581 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs @@ -232,7 +232,7 @@ pub struct FnDescriptor { } impl FnDescriptor { - pub fn new_opt(node: ast::FnDef) -> Option { + pub fn new(node: ast::FnDef) -> Option { let name = node.name()?.text().to_string(); // Strip the body out for the label. diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index b4faf0b5b..2ed6694ba 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -362,7 +362,7 @@ impl AnalysisImpl { for (_, fs) in file_symbols { if fs.kind == FN_DEF { if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) { - if let Some(descriptor) = FnDescriptor::new_opt(fn_def) { + if let Some(descriptor) = FnDescriptor::new(fn_def) { // If we have a calling expression let's find which argument we are on let mut current_parameter = None; diff --git a/crates/ra_analysis/src/job.rs b/crates/ra_analysis/src/job.rs index 57215c862..2871f9839 100644 --- a/crates/ra_analysis/src/job.rs +++ b/crates/ra_analysis/src/job.rs @@ -11,7 +11,7 @@ pub struct JobToken { } impl JobHandle { - pub fn new_pair() -> (JobHandle, JobToken) { + pub fn new() -> (JobHandle, JobToken) { let (sender_alive, receiver_alive) = bounded(0); let (sender_canceled, receiver_canceled) = bounded(0); let token = JobToken { diff --git a/crates/ra_analysis/tests/tests.rs b/crates/ra_analysis/tests/tests.rs index 3302e1151..e0c637d65 100644 --- a/crates/ra_analysis/tests/tests.rs +++ b/crates/ra_analysis/tests/tests.rs @@ -62,7 +62,7 @@ fn get_signature(text: &str) -> (FnDescriptor, Option) { let (offset, code) = extract_offset(text); let code = code.as_str(); - let (_handle, token) = JobHandle::new_pair(); + let (_handle, token) = JobHandle::new(); let snap = analysis(&[("/lib.rs", code)]); snap.resolve_callable(FileId(1), offset, &token).unwrap() @@ -71,7 +71,7 @@ fn get_signature(text: &str) -> (FnDescriptor, Option) { #[test] fn test_resolve_module() { let snap = analysis(&[("/lib.rs", "mod foo;"), ("/foo.rs", "")]); - let (_handle, token) = JobHandle::new_pair(); + let (_handle, token) = JobHandle::new(); let symbols = snap.approximately_resolve_symbol(FileId(1), 4.into(), &token); assert_eq_dbg( r#"[(FileId(2), FileSymbol { name: "foo", node_range: [0; 0), kind: MODULE })]"#, 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(), diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index 2623ab84e..a11baf4aa 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs @@ -355,7 +355,7 @@ impl<'a> PoolDispatcher<'a> { }; match req.cast::() { Ok((id, params)) => { - let (handle, token) = JobHandle::new_pair(); + let (handle, token) = JobHandle::new(); let world = self.world.snapshot(); let sender = self.sender.clone(); self.pool.spawn(move || { -- cgit v1.2.3