Skip to content

Commit d9752c7

Browse files
Improve env var getter docs
1 parent a12107a commit d9752c7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

library/std/src/env.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ impl fmt::Debug for VarsOs {
185185
///
186186
/// # Errors
187187
///
188-
/// Errors if the environment variable is not present.
189-
/// Errors if the environment variable is not valid Unicode. If this is not desired, consider using
190-
/// [`var_os`].
191-
/// May error if the `key` is empty, contains an ASCII equals sign `'='`, or contains the NUL character `'\0'`.
192-
/// May error when the value contains the NUL character.
188+
/// Returns `[None]` if the environment variable isn't set.
189+
/// Returns `[None]` if the environment variable is not valid Unicode. If this is not
190+
/// desired, consider using [`var_os`].
193191
///
194192
/// # Examples
195193
///
@@ -223,9 +221,8 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
223221
///
224222
/// # Errors
225223
///
226-
/// Errors if the variable isn't set.
227-
/// May error if the `key` is empty, contains an ASCII equals sign `'='`, or contains the NUL character `'\0'`.
228-
/// May error when the value contains the NUL character.
224+
/// Returns `[None]` if the variable isn't set.
225+
/// May return `[None]` if the variable value contains the NUL character.
229226
///
230227
/// # Examples
231228
///

0 commit comments

Comments
 (0)