-
Notifications
You must be signed in to change notification settings - Fork 157
Format, fix, document, Etc 07/15 #401
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
Format, fix, document, Etc 07/15 #401
Conversation
14fbf5d to
b912763
Compare
cberner
left a comment
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.
Had a minor comment about non-errors which I don't think we should document. If it doesn't make sense for a function to return an error, we should change the signature instead
bbbe3cd to
91f844f
Compare
|
I removed the redundant "does not error" documentation. Instead, I propose a commit in which we remove the unused Result type. Update: Sorry about the repeated pushing. Cargo |
91f844f to
d89c8cb
Compare
|
@cberner About the unmount functions. Claude suggested that it makes sense to handle the error, rather than return it, for the unmount case. Just because another thread panicked, doesn't mean that an unmount is unsafe or impossible. In fact, probably, the mount data is just fine and we can still do the unmount. No panics, no errors, it just does what it does. |
d89c8cb to
b496085
Compare
|
Hmm, I'll need to look at that change some more. Can you split the panic changes into a separate PR? Let's make this one only about the doc changes |
64d9786 to
b6602ec
Compare
src/session.rs
Outdated
| /// # Panics | ||
| /// Panics if the background thread can't be recovered. |
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.
Let's remove this. It's an implementation detail
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.
Clippy says if the function can panic, it should have documentation about that. Are you saying that we should pretend that the function cannot panic?
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.
I think we should only document things that are part of the public API, rather than implementation details. That is they're not going to change
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.
I removed most of them, but I didn't remove this one. Joining a background thread can panic, and sometimes should, panic. For example,
- A panic in the session thread would propagate to the main thread on
join(). - A deadlocked session thread may or may not cause a panic on
join(), depending on the OS.
These are both just a normal part of joining a background thread. The underlying call to thread::join() even has its own # Panic documentation. It would be disingenuous to imply that our function is somehow free from panics.
I did improve the # Panic section by clarifying an example.
src/notify.rs
Outdated
| /// inotify watchers of a file deletion. | ||
| /// # Errors | ||
| /// Returns an error if the notification data is too large. | ||
| /// Propagates errors due to communicating with the fuse device. |
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.
Propagates errors due to communicating with the fuse device.
Let's remove this in all the messages. I don't think it adds useful information. Returning an io::Result already explains that it propagates errors
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.
I guess that is a fair criticism.
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.
Reverted all of the unnecessary ones, but I did need to write something for the notify functions, so I revised the statement to clarify that it's the kernel causing the errors.
Clippy says that functions with the potential to error or panic should be labeled by a markdown section `#` in the doc string. [missing_errors_doc](https://rust-lang.github.io/rust-clippy/rust-1.51.0/index.html#missing_errors_doc) I've done my best to write some kind of reasonable statements; there is room for improvement.
Repaired incorrect doc strings which were likely the result of copy and paste errors.
b6602ec to
09ac510
Compare
|
Merged. Thanks for iterating on this. lgtm! |
Improved documentation for many items. Update: removed unused Result type. Update: properly using the Result type, where appropriate, while avoiding some avoidable panics.
Previous PR in sequence was #400
Next PR in sequence was #402
An additional PR #405 branches from this point.