Skip to content

Commit

Permalink
Make some formatting improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 4, 2019
1 parent 91e021a commit f5e0d0c
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/librustdoc/clean/types.rs
@@ -1,5 +1,3 @@
// ignore-tidy-filelength

use std::fmt;
use std::hash::{Hash, Hasher};
use std::default::Default;
Expand Down Expand Up @@ -88,7 +86,6 @@ pub struct Item {

impl fmt::Debug for Item {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {

let fake = MAX_DEF_ID.with(|m| m.borrow().get(&self.def_id.krate)
.map(|id| self.def_id >= *id).unwrap_or(false));
let def_id: &dyn fmt::Debug = if fake { &"**FAKE**" } else { &self.def_id };
Expand All @@ -112,6 +109,7 @@ impl Item {
pub fn doc_value(&self) -> Option<&str> {
self.attrs.doc_value()
}

/// Finds all `doc` attributes as NameValues and returns their corresponding values, joined
/// with newlines.
pub fn collapsed_doc_value(&self) -> Option<String> {
Expand Down Expand Up @@ -174,7 +172,6 @@ impl Item {
pub fn is_keyword(&self) -> bool {
self.type_() == ItemType::Keyword
}

pub fn is_stripped(&self) -> bool {
match self.inner { StrippedItem(..) => true, _ => false }
}
Expand Down Expand Up @@ -456,9 +453,7 @@ impl Attributes {
/// Reads a `MetaItem` from within an attribute, looks for whether it is a
/// `#[doc(include="file")]`, and returns the filename and contents of the file as loaded from
/// its expansion.
pub fn extract_include(mi: &ast::MetaItem)
-> Option<(String, String)>
{
pub fn extract_include(mi: &ast::MetaItem) -> Option<(String, String)> {
mi.meta_item_list().and_then(|list| {
for meta in list {
if meta.check_name(sym::include) {
Expand Down Expand Up @@ -508,8 +503,7 @@ impl Attributes {
false
}

pub fn from_ast(diagnostic: &::errors::Handler,
attrs: &[ast::Attribute]) -> Attributes {
pub fn from_ast(diagnostic: &::errors::Handler, attrs: &[ast::Attribute]) -> Attributes {
let mut doc_strings = vec![];
let mut sp = None;
let mut cfg = Cfg::True;
Expand All @@ -520,7 +514,7 @@ impl Attributes {
/// returns `attr` unchanged.
pub fn with_doc_comment_markers_stripped<T>(
attr: &Attribute,
f: impl FnOnce(&Attribute) -> T
f: impl FnOnce(&Attribute) -> T,
) -> T {
match attr.kind {
AttrKind::Normal(_) => {
Expand Down Expand Up @@ -823,7 +817,6 @@ impl GenericParamDefKind {
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct GenericParamDef {
pub name: String,

pub kind: GenericParamDefKind,
}

Expand Down

0 comments on commit f5e0d0c

Please sign in to comment.