Skip to content

Commit

Permalink
Fix tidy check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
h-michael committed Feb 23, 2019
1 parent 1932d7a commit 1fe87df
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/librustdoc/clean/auto_trait.rs
Expand Up @@ -220,7 +220,10 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
}
}

fn get_lifetime(&self, region: Region<'_>, names_map: &FxHashMap<String, Lifetime>) -> Lifetime {
fn get_lifetime(
&self, region: Region<'_>,
names_map: &FxHashMap<String, Lifetime>
) -> Lifetime {
self.region_name(region)
.map(|name| {
names_map.get(&name).unwrap_or_else(|| {
Expand Down
13 changes: 11 additions & 2 deletions src/librustdoc/clean/inline.rs
Expand Up @@ -35,7 +35,12 @@ use super::Clean;
///
/// The returned value is `None` if the definition could not be inlined,
/// and `Some` of a vector of items if it was successfully expanded.
pub fn try_inline(cx: &DocContext<'_, '_, '_>, def: Def, name: ast::Name, visited: &mut FxHashSet<DefId>)
pub fn try_inline(
cx: &DocContext<'_, '_, '_>,
def: Def,
name: ast::Name,
visited: &mut FxHashSet<DefId>
)
-> Option<Vec<clean::Item>> {
let did = if let Some(did) = def.opt_def_id() {
did
Expand Down Expand Up @@ -387,7 +392,11 @@ pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec<clean::
});
}

fn build_module(cx: &DocContext<'_, '_, '_>, did: DefId, visited: &mut FxHashSet<DefId>) -> clean::Module {
fn build_module(
cx: &DocContext<'_, '_, '_>,
did: DefId,
visited: &mut FxHashSet<DefId>
) -> clean::Module {
let mut items = Vec::new();
fill_in(cx, did, &mut items, visited);
return clean::Module {
Expand Down
28 changes: 23 additions & 5 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -3523,23 +3523,37 @@ pub struct Impl {
pub blanket_impl: Option<Type>,
}

pub fn get_auto_traits_with_node_id(cx: &DocContext<'_, '_, '_>, id: ast::NodeId, name: String) -> Vec<Item> {
pub fn get_auto_traits_with_node_id(
cx: &DocContext<'_, '_, '_>,
id: ast::NodeId,
name: String
) -> Vec<Item> {
let finder = AutoTraitFinder::new(cx);
finder.get_with_node_id(id, name)
}

pub fn get_auto_traits_with_def_id(cx: &DocContext<'_, '_, '_>, id: DefId) -> Vec<Item> {
pub fn get_auto_traits_with_def_id(
cx: &DocContext<'_, '_, '_>,
id: DefId
) -> Vec<Item> {
let finder = AutoTraitFinder::new(cx);

finder.get_with_def_id(id)
}

pub fn get_blanket_impls_with_node_id(cx: &DocContext<'_, '_, '_>, id: ast::NodeId, name: String) -> Vec<Item> {
pub fn get_blanket_impls_with_node_id(
cx: &DocContext<'_, '_, '_>,
id: ast::NodeId,
name: String
) -> Vec<Item> {
let finder = BlanketImplFinder::new(cx);
finder.get_with_node_id(id, name)
}

pub fn get_blanket_impls_with_def_id(cx: &DocContext<'_, '_, '_>, id: DefId) -> Vec<Item> {
pub fn get_blanket_impls_with_def_id(
cx: &DocContext<'_, '_, '_>,
id: DefId
) -> Vec<Item> {
let finder = BlanketImplFinder::new(cx);

finder.get_with_def_id(id)
Expand Down Expand Up @@ -4095,7 +4109,11 @@ impl Clean<TypeBinding> for hir::TypeBinding {
}
}

pub fn def_id_to_path(cx: &DocContext<'_, '_, '_>, did: DefId, name: Option<String>) -> Vec<String> {
pub fn def_id_to_path(
cx: &DocContext<'_, '_, '_>,
did: DefId,
name: Option<String>
) -> Vec<String> {
let crate_name = name.unwrap_or_else(|| cx.tcx.crate_name(did.krate).to_string());
let relative = cx.tcx.def_path(did).data.into_iter().filter_map(|elem| {
// extern blocks have an empty name
Expand Down
9 changes: 7 additions & 2 deletions src/librustdoc/html/render.rs
Expand Up @@ -2541,8 +2541,13 @@ fn render_markdown(w: &mut fmt::Formatter<'_>,
cx.codes))
}

fn document_short(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item, link: AssocItemLink<'_>,
prefix: &str, is_hidden: bool) -> fmt::Result {
fn document_short(
w: &mut fmt::Formatter<'_>,
cx: &Context,
item: &clean::Item,
link: AssocItemLink<'_>,
prefix: &str, is_hidden: bool
) -> fmt::Result {
if let Some(s) = item.doc_value() {
let markdown = if s.contains('\n') {
format!("{} [Read more]({})",
Expand Down

0 comments on commit 1fe87df

Please sign in to comment.