Skip to content

Commit

Permalink
Improve functions naming
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 4, 2018
1 parent 2758de4 commit fc81adb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/clean/auto_trait.rs
Expand Up @@ -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::*;
Expand All @@ -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))
})
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/clean/blanket_impl.rs
Expand Up @@ -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> {
Expand All @@ -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))
})
Expand Down
14 changes: 7 additions & 7 deletions src/librustdoc/clean/def_ctor.rs
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fc81adb

Please sign in to comment.