Skip to content

Commit fbaa4a2

Browse files
Rollup merge of #88109 - inquisitivecrystal:env-docs, r=m-ou-se
Fix environment variable getter docs `@RalfJung` pointed out a number of errors and suboptimal choices I made in my documentation for #86183. This PR should (hopefully) fix the problems they've identified.
2 parents fe025a7 + fdf0913 commit fbaa4a2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

library/std/src/env.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,13 @@ impl fmt::Debug for VarsOs {
185185
///
186186
/// # Errors
187187
///
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`].
188+
/// This function will return an error if the environment variable isn't set.
189+
///
190+
/// This function may return an error if the environment variable's name contains
191+
/// the equal sign character (`=`) or the NUL character.
192+
///
193+
/// This function will return an error if the environment variable's value is
194+
/// not valid Unicode. If this is not desired, consider using [`var_os`].
191195
///
192196
/// # Examples
193197
///
@@ -221,8 +225,13 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
221225
///
222226
/// # Errors
223227
///
224-
/// Returns `[None]` if the variable isn't set.
225-
/// May return `[None]` if the variable value contains the NUL character.
228+
/// This function returns an error if the environment variable isn't set.
229+
///
230+
/// This function may return an error if the environment variable's name contains
231+
/// the equal sign character (`=`) or the NUL character.
232+
///
233+
/// This function may return an error if the environment variable's value contains
234+
/// the NUL character.
226235
///
227236
/// # Examples
228237
///

0 commit comments

Comments
 (0)