Revert "clippy: Fix new_ret_no_self"

This reverts commit 2ae9dfa812.
This commit is contained in:
Alan Du 2018-10-20 12:29:25 -04:00
parent 6dd3fa6a94
commit 0857c22f26
7 changed files with 17 additions and 17 deletions

View File

@ -232,7 +232,7 @@ pub struct FnDescriptor {
}
impl FnDescriptor {
pub fn new_opt(node: ast::FnDef) -> Option<Self> {
pub fn new(node: ast::FnDef) -> Option<Self> {
let name = node.name()?.text().to_string();
// Strip the body out for the label.

View File

@ -362,7 +362,7 @@ pub fn resolve_callable(
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;

View File

@ -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 {

View File

@ -62,7 +62,7 @@ fn get_signature(text: &str) -> (FnDescriptor, Option<usize>) {
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<usize>) {
#[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 })]"#,

View File

@ -63,7 +63,7 @@ fn add_bindings(&mut self, scope: ScopeId, pat: ast::Pat) {
.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<ast::ParamList>) {
@ -88,7 +88,7 @@ pub struct ScopeEntry {
}
impl ScopeEntry {
fn new_opt(pat: ast::BindPat) -> Option<ScopeEntry> {
fn new(pat: ast::BindPat) -> Option<ScopeEntry> {
if pat.name().is_some() {
Some(ScopeEntry {
syntax: pat.syntax().owned(),

View File

@ -22,14 +22,14 @@ pub fn new(items: AstChildren<ast::ModuleItem>) -> 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 @@ pub fn entries(&self) -> &[Entry] {
}
impl Entry {
fn new_item<'a>(item: impl ast::NameOwner<'a>) -> Option<Entry> {
fn new<'a>(item: impl ast::NameOwner<'a>) -> Option<Entry> {
let name = item.name()?;
Some(Entry {
node: name.syntax().owned(),

View File

@ -355,7 +355,7 @@ fn on<'b, R>(
};
match req.cast::<R>() {
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 || {