Skip to content

Commit b675824

Browse files
authored
Rollup merge of #75945 - pickfire:patch-7, r=jyn514
Use `env::func()`, not 'the function env::func' in docs for std::env Follow up of #75629 r? @jyn514
2 parents d824b23 + 1d017eb commit b675824

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

library/std/src/env.rs

+25-26
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,19 @@ pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
6868

6969
/// An iterator over a snapshot of the environment variables of this process.
7070
///
71-
/// This structure is created by the [`std::env::vars`] function. See its
72-
/// documentation for more.
71+
/// This structure is created by [`env::vars()`]. See its documentation for more.
7372
///
74-
/// [`std::env::vars`]: vars
73+
/// [`env::vars()`]: vars
7574
#[stable(feature = "env", since = "1.0.0")]
7675
pub struct Vars {
7776
inner: VarsOs,
7877
}
7978

8079
/// An iterator over a snapshot of the environment variables of this process.
8180
///
82-
/// This structure is created by the [`std::env::vars_os`] function. See
83-
/// its documentation for more.
81+
/// This structure is created by [`env::vars_os()`]. See its documentation for more.
8482
///
85-
/// [`std::env::vars_os`]: vars_os
83+
/// [`env::vars_os()`]: vars_os
8684
#[stable(feature = "env", since = "1.0.0")]
8785
pub struct VarsOs {
8886
inner: os_imp::Env,
@@ -98,10 +96,8 @@ pub struct VarsOs {
9896
/// # Panics
9997
///
10098
/// While iterating, the returned iterator will panic if any key or value in the
101-
/// environment is not valid unicode. If this is not desired, consider using the
102-
/// [`env::vars_os`] function.
103-
///
104-
/// [`env::vars_os`]: vars_os
99+
/// environment is not valid unicode. If this is not desired, consider using
100+
/// [`env::vars_os()`].
105101
///
106102
/// # Examples
107103
///
@@ -114,6 +110,8 @@ pub struct VarsOs {
114110
/// println!("{}: {}", key, value);
115111
/// }
116112
/// ```
113+
///
114+
/// [`env::vars_os()`]: vars_os
117115
#[stable(feature = "env", since = "1.0.0")]
118116
pub fn vars() -> Vars {
119117
Vars { inner: vars_os() }
@@ -245,9 +243,9 @@ fn _var_os(key: &OsStr) -> Option<OsString> {
245243
}
246244

247245
/// The error type for operations interacting with environment variables.
248-
/// Possibly returned from the [`env::var`] function.
246+
/// Possibly returned from [`env::var()`].
249247
///
250-
/// [`env::var`]: var
248+
/// [`env::var()`]: var
251249
#[derive(Debug, PartialEq, Eq, Clone)]
252250
#[stable(feature = "env", since = "1.0.0")]
253251
pub enum VarError {
@@ -372,10 +370,10 @@ fn _remove_var(k: &OsStr) {
372370
///
373371
/// The iterator element type is [`PathBuf`].
374372
///
375-
/// This structure is created by the [`std::env::split_paths`] function. See its
373+
/// This structure is created by [`env::split_paths()`]. See its
376374
/// documentation for more.
377375
///
378-
/// [`std::env::split_paths`]: split_paths
376+
/// [`env::split_paths()`]: split_paths
379377
#[stable(feature = "env", since = "1.0.0")]
380378
pub struct SplitPaths<'a> {
381379
inner: os_imp::SplitPaths<'a>,
@@ -426,9 +424,9 @@ impl fmt::Debug for SplitPaths<'_> {
426424
}
427425

428426
/// The error type for operations on the `PATH` variable. Possibly returned from
429-
/// the [`env::join_paths`] function.
427+
/// [`env::join_paths()`].
430428
///
431-
/// [`env::join_paths`]: join_paths
429+
/// [`env::join_paths()`]: join_paths
432430
#[derive(Debug)]
433431
#[stable(feature = "env", since = "1.0.0")]
434432
pub struct JoinPathsError {
@@ -463,7 +461,8 @@ pub struct JoinPathsError {
463461
/// }
464462
/// ```
465463
///
466-
/// Joining a path containing a colon on a Unix-like platform results in an error:
464+
/// Joining a path containing a colon on a Unix-like platform results in an
465+
/// error:
467466
///
468467
/// ```
469468
/// # if cfg!(unix) {
@@ -475,8 +474,8 @@ pub struct JoinPathsError {
475474
/// # }
476475
/// ```
477476
///
478-
/// Using `env::join_paths` with [`env::split_paths`] to append an item to the `PATH` environment
479-
/// variable:
477+
/// Using `env::join_paths()` with [`env::split_paths()`] to append an item to
478+
/// the `PATH` environment variable:
480479
///
481480
/// ```
482481
/// use std::env;
@@ -494,7 +493,7 @@ pub struct JoinPathsError {
494493
/// }
495494
/// ```
496495
///
497-
/// [`env::split_paths`]: split_paths
496+
/// [`env::split_paths()`]: split_paths
498497
#[stable(feature = "env", since = "1.0.0")]
499498
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
500499
where
@@ -667,14 +666,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
667666
/// An iterator over the arguments of a process, yielding a [`String`] value for
668667
/// each argument.
669668
///
670-
/// This struct is created by the [`std::env::args`] function. See its
671-
/// documentation for more.
669+
/// This struct is created by [`env::args()`]. See its documentation
670+
/// for more.
672671
///
673672
/// The first element is traditionally the path of the executable, but it can be
674673
/// set to arbitrary text, and may not even exist. This means this property
675674
/// should not be relied upon for security purposes.
676675
///
677-
/// [`std::env::args`]: args
676+
/// [`env::args()`]: args
678677
#[stable(feature = "env", since = "1.0.0")]
679678
pub struct Args {
680679
inner: ArgsOs,
@@ -683,14 +682,14 @@ pub struct Args {
683682
/// An iterator over the arguments of a process, yielding an [`OsString`] value
684683
/// for each argument.
685684
///
686-
/// This struct is created by the [`std::env::args_os`] function. See its
687-
/// documentation for more.
685+
/// This struct is created by [`env::args_os()`]. See its documentation
686+
/// for more.
688687
///
689688
/// The first element is traditionally the path of the executable, but it can be
690689
/// set to arbitrary text, and may not even exist. This means this property
691690
/// should not be relied upon for security purposes.
692691
///
693-
/// [`std::env::args_os`]: args_os
692+
/// [`env::args_os()`]: args_os
694693
#[stable(feature = "env", since = "1.0.0")]
695694
pub struct ArgsOs {
696695
inner: sys::args::Args,

0 commit comments

Comments
 (0)