-
Notifications
You must be signed in to change notification settings - Fork 27
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
Pile improvements 1 #233
base: main
Are you sure you want to change the base?
Pile improvements 1 #233
Conversation
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.
Great finds about the missing must_uses. I even explicitly disabled it in one location as you can see with one of the suggested edits on this PR.
@@ -185,6 +192,12 @@ impl std::ops::Deref for PendingPiledWidget { | |||
} | |||
|
|||
/// A widget that has been added to a [`Pile`]. | |||
/// | |||
/// If this is dropped, the widget will be removed from the Pile. |
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.
/// If this is dropped, the widget will be removed from the Pile. | |
/// When the last clone of a `PiledWidget` is dropped, the widget will be removed from the Pile. |
@@ -218,6 +231,7 @@ struct PiledWidgetData { | |||
|
|||
impl Drop for PiledWidgetData { | |||
fn drop(&mut self) { | |||
println!("drop called"); |
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.
println!("drop called"); |
@@ -67,6 +69,9 @@ impl Pile { | |||
/// When the last clone of the returned [`PiledWidget`] is dropped, `widget` | |||
/// will be removed from the pile. If it is the currently visible widget, | |||
/// the next widget in the pile will be made visible. | |||
/// | |||
/// See [`PiledWidget`] for important lifetime information. |
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.
Doesn't the paragraph directly before this statement explain what the summary added to PiledWidget
states?
@@ -49,6 +49,8 @@ impl PileData { | |||
impl Pile { | |||
/// Returns a placeholder that can be used to show/close a piled widget | |||
/// before it has been constructed. | |||
/// | |||
/// See [`PiledWidget`] for important lifetime information. |
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.
The return type of this function isn't a PiledWidget
but a PendingPIledWidget
, so this tip seems wrong.
@@ -164,6 +169,8 @@ pub struct PendingPiledWidget(Option<PiledWidget>); | |||
|
|||
impl PendingPiledWidget { | |||
/// Place `widget` in the pile and returns a handle to the placed widget. | |||
/// | |||
/// See [`PiledWidget`] for important lifetime information. |
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.
/// See [`PiledWidget`] for important lifetime information. | |
/// When the last clone of the returned [`PiledWidget`] is dropped, `widget` | |
/// will be removed from the pile. If it is the currently visible widget, | |
/// the next widget in the pile will be made visible. |
I prefer not making the user jump through links to read information like this. I've pasted the summary from push
as the suggestion here.
@@ -164,6 +169,8 @@ pub struct PendingPiledWidget(Option<PiledWidget>); | |||
|
|||
impl PendingPiledWidget { | |||
/// Place `widget` in the pile and returns a handle to the placed widget. | |||
/// | |||
/// See [`PiledWidget`] for important lifetime information. | |||
#[allow(clippy::must_use_candidate)] |
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.
#[allow(clippy::must_use_candidate)] | |
#[must_use] |
This seems like an oversight by me.
/// Lifetimes: | ||
/// | ||
/// Due to how this macro works variables in the closure will be dropped at the end of the | ||
/// method body, and *NOT* when the application terminates. |
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.
Did you test that this documentation shows up when running cargo doc
? I ask because this macro already has documentation in another location:
Lines 46 to 47 in f6a4704
/// The function body is executed during application startup, and the app will | |
/// continue running until the last window is closed. |
I linked to the paragraph where I tried to explain what is happening. It seems like that should be updated to be more explicit.
Improvements based on discoveries made in #231