-
Notifications
You must be signed in to change notification settings - Fork 13.3k
librustdoc: improve testnames for doctests #29600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
.next() | ||
.or_else(|| typename_if_impl(&item)); | ||
|
||
let pushed = name.map(|name| self.names.push(name)).is_some(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little bit hard to follow, so perhaps this could use explicit control flow + if let Some(...) = ...
to match what's going on here? Currently it's somewhat non-idiomatic to call .iter()
on an option or rely on functions like map
for side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, it got a bit out of hand, will do.
57a0430
to
26e99fc
Compare
@alexcrichton Adjusted from feedback |
|
||
fn typename_if_impl(item: &clean::Item) -> Option<String> { | ||
if let clean::ItemEnum::ImplItem(ref impl_) = item.inner { | ||
let path = <clean::Type as ToString>::to_string(&impl_.for_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah it's fine to use .to_string()
here, I was just getting confused :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed adding.to_string()
again :)
26e99fc
to
4202615
Compare
Old doctest names ```bash test sync::atomic::load_0 ... ok test sync::atomic::load_0 ... ok test sync::atomic::load_0 ... ok test sync::atomic::load_0 ... ok ``` New doctest names ```bash test sync::atomic::AtomicBool::load_0 ... ok test sync::atomic::AtomicIsize::load_0 ... ok test sync::atomic::AtomicPtr<T>::load_0 ... ok test sync::atomic::AtomicUsize::load_0 ... ok ```
Old doctest names
New doctest names