Skip to content
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

Merged
merged 1 commit into from
Jun 30, 2017
Merged

Conversation

msehnout
Copy link
Sponsor Contributor

Fixes: #25 except for "examples on WalkDirIterator.skip_current_dir" because there is no unwrap()

Copy link
Contributor

@budziq budziq left a 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
Copy link
Contributor

@budziq budziq Jun 17, 2017

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.

Copy link
Sponsor Contributor Author

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};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add newline?

Copy link
Sponsor Contributor Author

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};
Copy link
Contributor

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.

Copy link
Sponsor Contributor Author

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> {
Copy link
Contributor

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.

Copy link
Sponsor Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand corrected 😄

@msehnout msehnout force-pushed the master branch 2 times, most recently from b984671 to b2e3670 Compare June 19, 2017 08:24
@msehnout
Copy link
Sponsor Contributor Author

@budziq I've submitted a new version of this PR with fixed issues and reverted travis.yml.

@budziq
Copy link
Contributor

budziq commented Jun 19, 2017

@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 ? operator was stabilized later in rust 1.13 so any builds with ? will always fail unless:

  1. @BurntSushi decides to move minimal backwards compatible version to 1.13 and you update the travis.yml
  2. you change ? to try!

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.

@msehnout
Copy link
Sponsor Contributor Author

@budziq I think I'll just wait for @BurntSushi's opinion.

@BurntSushi
Copy link
Owner

Since we're releasing a 2.0, I think we should bump the minimum Rust version as well! I think we should move to Rust 1.16, which is $CURRENT - 2.

@msehnout
Copy link
Sponsor Contributor Author

Sounds good to me. Once the version in travis is changed, I can rebase this patch to run CI again.

@msehnout
Copy link
Sponsor Contributor Author

Or should I bump it?

@budziq
Copy link
Contributor

budziq commented Jun 29, 2017

@msehnout version bum is already waiting for merge #62

@BurntSushi
Copy link
Owner

Thanks! I think this is ready to go but needs a rebase first.

@msehnout
Copy link
Sponsor Contributor Author

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.

@msehnout
Copy link
Sponsor Contributor Author

It should be ready.

@BurntSushi BurntSushi merged commit 938b0fa into BurntSushi:master Jun 30, 2017
@BurntSushi
Copy link
Owner

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants