Unwrap Visibility fields
There's not really any reason to not have the visibility default to inherited, and this saves us the trouble of checking everywhere for whether we have a visibility or not.
This commit is contained in:
parent
04b27efa00
commit
ec349bef24
7 changed files with 27 additions and 32 deletions
|
|
@ -111,7 +111,7 @@ impl Buffer {
|
|||
/// Helper to render an optional visibility with a space after it (if the
|
||||
/// visibility is preset)
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct VisSpace<'a>(pub &'a Option<clean::Visibility>);
|
||||
pub struct VisSpace<'a>(pub &'a clean::Visibility);
|
||||
/// Similarly to VisSpace, this structure is used to render a function style with a
|
||||
/// space after it.
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
@ -1034,11 +1034,7 @@ impl Function<'_> {
|
|||
|
||||
impl<'a> fmt::Display for VisSpace<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(v) = self.0 {
|
||||
fmt::Display::fmt(&v.print_with_space(), f)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
fmt::Display::fmt(&self.0.print_with_space(), f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1511,7 +1511,7 @@ impl DocFolder for Cache {
|
|||
self.paths.insert(item.def_id, (stack, ItemType::Enum));
|
||||
}
|
||||
|
||||
clean::PrimitiveItem(..) if item.visibility.is_some() => {
|
||||
clean::PrimitiveItem(..) => {
|
||||
self.add_aliases(&item);
|
||||
self.paths.insert(item.def_id, (self.stack.clone(),
|
||||
item.type_()));
|
||||
|
|
@ -4306,8 +4306,7 @@ fn get_methods(
|
|||
) -> Vec<String> {
|
||||
i.items.iter().filter_map(|item| {
|
||||
match item.name {
|
||||
// Maybe check with clean::Visibility::Public as well?
|
||||
Some(ref name) if !name.is_empty() && item.visibility.is_some() && item.is_method() => {
|
||||
Some(ref name) if !name.is_empty() && item.is_method() => {
|
||||
if !for_deref || should_render_item(item, deref_mut) {
|
||||
Some(format!("<a href=\"#{}\">{}</a>",
|
||||
get_next_url(used_links, format!("method.{}", name)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue