Remove suffix from duplicate members
We use the HTML ID of a member element to get its name. If there are multiple members with the same type and name (e. g. from a Deref implementation), the ID has a suffix to make it unique. Previosuly, we just interpreted this suffix as part of the name. With this patch, we strip the suffix and only use the actual name.
This commit is contained in:
parent
642bec6687
commit
0c38bf9606
@ -5,6 +5,10 @@ SPDX-License-Identifier: MIT
|
||||
|
||||
# Changelog for rusty-man
|
||||
|
||||
# Unreleased
|
||||
|
||||
- Remove suffix from duplicate members (e. g. from Deref implementations).
|
||||
|
||||
## v0.3.0 (2020-09-11)
|
||||
|
||||
This minor release adds support for Rust 1.46.0 and significantly improves the
|
||||
|
@ -279,8 +279,15 @@ const MODULE_MEMBER_TYPES: &[doc::ItemType] = &[
|
||||
];
|
||||
|
||||
fn get_id_part(node: &kuchiki::NodeRef, i: usize) -> Option<String> {
|
||||
node.get_attribute("id")
|
||||
.and_then(|s| s.splitn(2, '.').nth(i).map(ToOwned::to_owned))
|
||||
// id of format <type>.<name> (or <type>.<name>-<idx> for name collisions)
|
||||
if let Some(id) = node.get_attribute("id") {
|
||||
id.splitn(2, '.')
|
||||
.nth(i)
|
||||
.and_then(|s| s.splitn(2, '-').next())
|
||||
.map(ToOwned::to_owned)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn get_fields(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(path, &[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(path, &[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(path, &[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(path, &[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(path, &[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/output.rs
|
||||
expression: "get_stdout(&[item])"
|
||||
expression: "get_stdout(path, &[\"anyhow::Error\"])"
|
||||
---
|
||||
anyhow Struct anyhow::Error rusty-man
|
||||
|
||||
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
@ -239,21 +239,21 @@ METHODS
|
||||
Downcast this error object by mutable reference.
|
||||
|
||||
Methods from Deref<Target = dyn StdError + Send + Sync + 'static>
|
||||
is-1
|
||||
is
|
||||
pub fn is<T>(&self) -> bool
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns `true` if the boxed type is the same as `T`
|
||||
|
||||
downcast_ref-1
|
||||
downcast_ref
|
||||
pub fn downcast_ref<T>(&self) -> Option<&T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
||||
Returns some reference to the boxed value if it is of type `T`, or `None` if it isn't.
|
||||
|
||||
downcast_mut-1
|
||||
downcast_mut
|
||||
pub fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||
where
|
||||
T: 'static + Error,
|
||||
|
Loading…
Reference in New Issue
Block a user