-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 Errors section from var_os docs #109894
Remove Errors section from var_os docs #109894
Conversation
Remove `Errors` section from `var_os` documentation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
While it can't return an error, it can still return |
@Nilstrieb the documentation already mentions that |
Right, the wording should be more like "on Error returns I don't think removing the section entirely is a good idea. It contains useful information even if it mixes up the return type. |
Re-introduced some of the former errors as situations where `None` is returned.
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Good point. I have reworded the documentation. The original Errors are now reformulated as situations where None is returned. (The error about invalid Unicode is gone for good, though.) |
Co-authored-by: León Orell Valerian Liehr <[email protected]>
one is enough
Original `var_os` description said that it _may_ return an error if the value contains `=` or NUL. Let's make no promises on the `None` return value in these situation either, keep it in the [potential mood](https://en.wikipedia.org/wiki/Grammatical_mood#Potential).
library/std/src/env.rs
Outdated
@@ -236,22 +236,14 @@ fn _var(key: &OsStr) -> Result<String, VarError> { | |||
} | |||
|
|||
/// Fetches the environment variable `key` from the current process, returning | |||
/// [`None`] if the variable isn't set or there's another error. | |||
/// [`None`] if the environment variable isn't set. It may return `None` also |
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.
Note, the first paragraph is best as a relatively short "title", as that's what will be listed on the module page. Can you break this up?
Further referring to `var_os` as a "function" (like in `var`), rather than "method".
Thanks! @bors r+ rollup |
…mpiler-errors Rollup of 10 pull requests Successful merges: - rust-lang#96971 (Initial support for loongarch64-unknown-linux-gnu) - rust-lang#109894 (Remove Errors section from var_os docs) - rust-lang#110000 (Rename tests/ui/unique to tests/ui/box/unit) - rust-lang#110018 (Pass host linker to compiletest.) - rust-lang#110104 ( Reword the docstring in todo! macro definition, fixing a typo) - rust-lang#110113 (Fix `x test ui --target foo` when download-rustc is enabled) - rust-lang#110126 (Support safe transmute in new solver) - rust-lang#110155 (Fix typos in librustdoc, tools and config files) - rust-lang#110162 (rustdoc: remove redundant expandSection code from main.js) - rust-lang#110173 (kmc-solid: Implement `Socket::read_buf`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
…rkingjubilee doc: std::env::var: Returns None for names with '=' or NUL byte The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
…rkingjubilee doc: std::env::var: Returns None for names with '=' or NUL byte The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
…rkingjubilee doc: std::env::var: Returns None for names with '=' or NUL byte The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
Rollup merge of rust-lang#128902 - evanj:evan.jones/env-var-doc, r=workingjubilee doc: std::env::var: Returns None for names with '=' or NUL byte The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request rust-lang#109894, which closed Issue rust-lang#109893. This documentation was incorrectly added in commit f2c0f29, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
Remove
Errors
section fromvar_os
documentation, fixes #109893