Improve functions naming

This commit is contained in:
Guillaume Gomez 2018-07-31 22:40:55 +02:00
parent 2758de4b95
commit fc81adb3c2
3 changed files with 13 additions and 13 deletions

View File

@ -16,7 +16,7 @@ use rustc::infer::InferOk;
use rustc::middle::cstore::CrateStore;
use std::fmt::Debug;
use self::def_ctor::{get_def_ctor_from_def_id, get_def_ctor_from_node_id};
use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
use self::finder_trait::Finder;
use super::*;
@ -34,13 +34,13 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> {
}
pub fn get_with_def_id(&self, def_id: DefId) -> Vec<Item> {
get_def_ctor_from_def_id(&self.cx, def_id, &|def_ctor| {
get_def_from_def_id(&self.cx, def_id, &|def_ctor| {
self.get_auto_trait_impls(def_id, &def_ctor, None)
})
}
pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec<Item> {
get_def_ctor_from_node_id(&self.cx, id, name, &|def_ctor, name| {
get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| {
let did = self.cx.tcx.hir.local_def_id(id);
self.get_auto_trait_impls(did, &def_ctor, Some(name))
})

View File

@ -19,7 +19,7 @@ use core::DocAccessLevels;
use super::*;
use self::def_ctor::{get_def_ctor_from_def_id, get_def_ctor_from_node_id};
use self::def_ctor::{get_def_from_def_id, get_def_from_node_id};
use self::finder_trait::Finder;
pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> {
@ -32,13 +32,13 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> {
}
pub fn get_with_def_id(&self, def_id: DefId) -> Vec<Item> {
get_def_ctor_from_def_id(&self.cx, def_id, &|def_ctor| {
get_def_from_def_id(&self.cx, def_id, &|def_ctor| {
self.get_blanket_impls(def_id, &def_ctor, None)
})
}
pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec<Item> {
get_def_ctor_from_node_id(&self.cx, id, name, &|def_ctor, name| {
get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| {
let did = self.cx.tcx.hir.local_def_id(id);
self.get_blanket_impls(did, &def_ctor, Some(name))
})

View File

@ -12,9 +12,9 @@ use core::DocContext;
use super::*;
pub fn get_def_ctor_from_def_id<F>(cx: &DocContext,
def_id: DefId,
callback: &F,
pub fn get_def_from_def_id<F>(cx: &DocContext,
def_id: DefId,
callback: &F,
) -> Vec<Item>
where F: Fn(& dyn Fn(DefId) -> Def) -> Vec<Item> {
let ty = cx.tcx.type_of(def_id);
@ -48,10 +48,10 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec<Item> {
}
}
pub fn get_def_ctor_from_node_id<F>(cx: &DocContext,
id: ast::NodeId,
name: String,
callback: &F,
pub fn get_def_from_node_id<F>(cx: &DocContext,
id: ast::NodeId,
name: String,
callback: &F,
) -> Vec<Item>
where F: Fn(& dyn Fn(DefId) -> Def, String) -> Vec<Item> {
let item = &cx.tcx.hir.expect_item(id).node;