-
Notifications
You must be signed in to change notification settings - Fork 106
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
Use ?
in docs instead of unwrapping
#52
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.
Hi @msehnout
Nice work! I would suggest few minor changes.
.travis.yml
Outdated
@@ -1,6 +1,6 @@ | |||
language: rust | |||
rust: | |||
- 1.10.0 | |||
- 1.18.0 |
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 the whole point of this travis entry was to check for backwards compatibility with older rust versions (not check with the latest stable 😄 as it is done in travis entry below)
Please note that "?" became stable in 1.13.0. @BurntSushi will have to decide if he wants to drop backwards compatibility with 1.10 for the sake of "?" in examples. Otherwise the try!
macro would have to be used instead.
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.
Sorry, I didn't know :-) Anyway I was following this guideline:
https://github.com/brson/rust-api-guidelines#examples-use--not-try-not-unwrap-c-question-mark
src/lib.rs
Outdated
@@ -67,7 +79,8 @@ This uses the `filter_entry` iterator adapter to avoid yielding hidden files | |||
and directories efficiently: | |||
|
|||
```rust,no_run | |||
use walkdir::{DirEntry, WalkDir, WalkDirIterator}; | |||
|
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.
why add newline?
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.
Sorry, typo
src/lib.rs
Outdated
@@ -28,12 +28,18 @@ The following code recursively iterates over the directory given and prints | |||
the path for each entry: | |||
|
|||
```rust,no_run | |||
use walkdir::WalkDir; | |||
use walkdir::{Error, WalkDir}; |
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 would suggest splitting the use
here into two lines and biding the Error
line as it should be part of the hidden error boilerplate.
this concerns all examples below.
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.
Sure, no problem.
src/lib.rs
Outdated
|
||
# fn try_main() -> Result<(), Error> { |
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.
as far as i know the convention is fn run()
but its not super important.
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.
Again, I was following this guideline and they use try_main() there:
https://github.com/brson/rust-api-guidelines#examples-use--not-try-not-unwrap-c-question-mark
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 stand corrected 😄
b984671
to
b2e3670
Compare
@budziq I've submitted a new version of this PR with fixed issues and reverted travis.yml. |
@msehnout reverting the travis.yml might be a little bit to early as now the travis build for backwards compatibility (rust 1.10.0) fails. Please note that the
I would suggest option 1. but it is not my place to decide 😸 I would suggest updating the PR to make it pass travis test. Chose one of the two options and wait for maintainers approval or suggestions. |
@budziq I think I'll just wait for @BurntSushi's opinion. |
Since we're releasing a |
Sounds good to me. Once the version in travis is changed, I can rebase this patch to run CI again. |
Or should I bump it? |
Thanks! I think this is ready to go but needs a rebase first. |
Ok, I have the fix, but I cannot authenticate against Github. Seems to be broken using either https or ssh. I'll submit the patch later. |
It should be ready. |
Awesome, thank you! |
Fixes: #25 except for "examples on WalkDirIterator.skip_current_dir" because there is no unwrap()