Skip to content

Commit 4cb73cc

Browse files
Preserve potential mood for equal or NUL sign
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).
1 parent a450557 commit 4cb73cc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: library/std/src/env.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
236236
}
237237

238238
/// Fetches the environment variable `key` from the current process, returning
239-
/// [`None`] in the following situations:
240-
///
241-
/// - the environment variable isn't set
242-
/// - the environment variable's name contains
243-
/// the equal sign character (`=`) or the NUL character
239+
/// [`None`] if the environment variable isn't set. It may return `None` also
240+
/// if the environment variable's name contains
241+
/// the equal sign character (`=`) or the NUL character.
244242
///
245243
/// Note that the method will not check if the environment variable
246244
/// is valid Unicode. If you want to have an error on invalid UTF-8,

0 commit comments

Comments
 (0)