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

remove unnecessary ok on dotenv result #38

Merged
merged 4 commits into from
Nov 18, 2022
Merged

Conversation

xiaoas
Copy link
Contributor

@xiaoas xiaoas commented Nov 7, 2022

fixes #37

Hope I've done this correctly🥲

@allan2 allan2 requested review from sonro and allan2 November 7, 2022 02:42
Copy link
Collaborator

@sonro sonro left a comment

Choose a reason for hiding this comment

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

Thank you for your PR!

We could do with both the .ok() and .unwrap()/? versions being present in the readme. It is often the first example a user will see, and most would not want their program to panic/throw if there is no .env file. It is supposed to be an optional way of passing environment variables into a program.

Instead of changing the existing example, we should have both, and a decription of which to use.

dotenv/src/lib.rs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Owner

@allan2 allan2 left a comment

Choose a reason for hiding this comment

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

I wrote my comments out last night but forgot to submit. @sonro I didn't mean to tag you and run!

There's also a discussion #39 related to this PR. Thanks @xiaoas for inspiring it.

README.md Outdated Show resolved Hide resolved
dotenv/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@sonro sonro left a comment

Choose a reason for hiding this comment

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

Thank you for the changes

@github-actions
Copy link

Code Coverage

@sonro sonro merged commit 8dacb5c into allan2:master Nov 18, 2022
@LeoniePhiline
Copy link
Contributor

@sonro Wouldn't it be best to make examples use proper error handling instead?

This will help beginners find into best practices asap.

@sonro
Copy link
Collaborator

sonro commented Dec 6, 2022

@LeoniePhiline

Wouldn't it be best to make examples use proper error handling instead?

I completely agree. This PR along with previous issues regarding this topic has led to a discussion about an API change (#39). Once that has been resolved more documentation (including examples) will surely follow.

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.

Change misleading usage examples
4 participants