You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first Rust code example, also available under examples/postgres/getting_started_step_1, is using .ok(); to discard the error case of a Result. If ignoring any errors is intentional, that line should be updated from
dotenv().ok();
to
let _ = dotenv();
Otherwise, the .ok() should be replaced by something else (maybe .expect("dotenv setup to be successful")).
Checklist
I have already looked over the issue tracker for similar issues.
This issue can be reproduced on Rust's stable channel. (Your issue will be
closed if this is not the case) N/A
The text was updated successfully, but these errors were encountered:
First of all: I'm also not sure what's the intended behavior there, for error cases, as I've not written that code. Beside of that the documentation of dotenv uses literally the same code so I would say it's fine.
As far as I understand those snippet it just looks for a file called .env and loads it's content as environment variables. As it is doing io there are many reasons this call can fail, so it returns an error. For applications that normally non-fatal as if this load fails a few environment variables are not set.
The first Rust code example, also available under examples/postgres/getting_started_step_1, is using
.ok();
to discard the error case of aResult
. If ignoring any errors is intentional, that line should be updated fromto
Otherwise, the
.ok()
should be replaced by something else (maybe.expect("dotenv setup to be successful")
).Checklist
This issue can be reproduced on Rust's stable channel. (Your issue will beN/Aclosed if this is not the case)
The text was updated successfully, but these errors were encountered: