More idiomatic code#57
More idiomatic code#57jplatte wants to merge 4 commits intodotenv-rs:masterfrom jplatte:more-idiomatic-code
Conversation
None of them really use it to convert Result to Option
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #57 +/- ##
=======================================
Coverage 86.77% 86.77%
=======================================
Files 7 7
Lines 242 242
=======================================
Hits 210 210
Misses 32 32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Plecra
left a comment
There was a problem hiding this comment.
The alternative to .ok() is interesting! I admit this syntax does seem like more idiomatic Rust, rather than just kinda hiding the must_use annotation on Results. I wonder if users will find the change jarring though... Personally I like it ^^
Do you expect me do anything here, e.g. leave that commit out for now? |
|
Sorry for being vague: I'm not a maintainer of this repository, so there's no need to follow my recommendations. I am hoping the Btw, there's an equivalent |
|
Yes, the |
|
Ping @ZoeyR |
|
I am without computer and decent internet for a bit. I'll start working on PRs once I have those in place. |
ghost
left a comment
There was a problem hiding this comment.
Overall looks good, there are just two places where some extra whitespace was accidentally removed.
|
Ping @ZoeyR |
|
@ZoeyR any chances you could have another look at this soon, or add another maintainer to the dotenv-rs org? |
I find it jarring, and think |
|
In projects where I don't want random crashes, I use dotenv like this: match dotenv() {
Ok(_) => (),
Err(ref err) if err.not_found() => (),
Err(e) => return Err(e.into()),
}I would very much prefer to just have: dotenv()?;... but I do not want an error if there is no |
The following is also duplicated in the changelog. - `dotenv` crate forked as `dotenvy` - `dotenv_codegen` forked as `dotenvy_codgen` - `dotenv_codegen_implementation` forked as `dotenvy_codegen_impl` - Crate description for dotenvy_codegen - Crate description for dotenvy_codgen_impl - New language in README - MIT license badge in README - Generate helpful errors from dotenv! macro (full merge of [dotenv-rs/dotenv #58](https://github.com/dotenv-rs/dotenv/pull/57/files#)) - replaced deprecated `std::env_home:dir()` with `dirs:home_dir` - Better handling of `home_dir` (merge of [dotenv-rs/dotenv #62](https://github.com/dotenv-rs/dotenv/pull/62/files#)) - assertions dealing with `Result` (based on [dotenv-rs/dotenv #57](https://github.com/dotenv-rs/dotenv/pull/57/files#)) - upgraded clap in `dotenvy` bin from v2 to v3.1 (covers [dotenv-rs/dotenv #76](https://github.com/dotenv-rs/dotenv/pull/76/files)) - example folder. The simple example has been moved to the README. - `extern` - unnecessary `use` statements in doc examples
|
@allan2's repo is now considered the new upstream, so just use it instead of this repo. |
Are these clear enough the way they are or should any of the changes have more explanation?