Skip to content

Commit 00cf550

Browse files
committed
Env use shorter intra-doc links in path
vars() rather than vars function Co-authored-by: Joshua Nelson <joshua@yottadb.com> Use [xxx()] rather than the [xxx] function Co-authored-by: Joshua Nelson <joshua@yottadb.com> Env text representation of function intra-doc link Suggested by @jyn514 Link join_paths in env doc for parity Change xxx to env::xxx for lib env doc Add link requsted by @jyn514 Fix doc build with same link Co-authored-by: Joshua Nelson <joshua@yottadb.com> Fix missing intra-doc link Fix added whitespace in doc Co-authored-by: Joshua Nelson <joshua@yottadb.com> Add brackets for `join_paths` Co-authored-by: Joshua Nelson <joshua@yottadb.com> Use unused link join_paths Removed same link for join_paths Co-authored-by: Joshua Nelson <joshua@yottadb.com> Remove unsed link join_paths
1 parent ced37a5 commit 00cf550

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
@@ -65,21 +65,19 @@ pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
6565

6666
/// An iterator over a snapshot of the environment variables of this process.
6767
///
68-
/// This structure is created by the [`std::env::vars`] function. See its
69-
/// documentation for more.
68+
/// This structure is created by [`env::vars()`]. See its documentation for more.
7069
///
71-
/// [`std::env::vars`]: vars
70+
/// [`env::vars()`]: vars
7271
#[stable(feature = "env", since = "1.0.0")]
7372
pub struct Vars {
7473
inner: VarsOs,
7574
}
7675

7776
/// An iterator over a snapshot of the environment variables of this process.
7877
///
79-
/// This structure is created by the [`std::env::vars_os`] function. See
80-
/// its documentation for more.
78+
/// This structure is created by [`env::vars_os()`]. See its documentation for more.
8179
///
82-
/// [`std::env::vars_os`]: vars_os
80+
/// [`env::vars()`]: vars
8381
#[stable(feature = "env", since = "1.0.0")]
8482
pub struct VarsOs {
8583
inner: os_imp::Env,
@@ -95,10 +93,8 @@ pub struct VarsOs {
9593
/// # Panics
9694
///
9795
/// While iterating, the returned iterator will panic if any key or value in the
98-
/// environment is not valid unicode. If this is not desired, consider using the
99-
/// [`env::vars_os`] function.
100-
///
101-
/// [`env::vars_os`]: vars_os
96+
/// environment is not valid unicode. If this is not desired, consider using
97+
/// [`env::vars_os()`].
10298
///
10399
/// # Examples
104100
///
@@ -111,6 +107,8 @@ pub struct VarsOs {
111107
/// println!("{}: {}", key, value);
112108
/// }
113109
/// ```
110+
///
111+
/// [`env::vars_os()`]: vars_os
114112
#[stable(feature = "env", since = "1.0.0")]
115113
pub fn vars() -> Vars {
116114
Vars { inner: vars_os() }
@@ -242,9 +240,9 @@ fn _var_os(key: &OsStr) -> Option<OsString> {
242240
}
243241

244242
/// The error type for operations interacting with environment variables.
245-
/// Possibly returned from the [`env::var`] function.
243+
/// Possibly returned from [`env::var()`].
246244
///
247-
/// [`env::var`]: var
245+
/// [`env::var()`]: var
248246
#[derive(Debug, PartialEq, Eq, Clone)]
249247
#[stable(feature = "env", since = "1.0.0")]
250248
pub enum VarError {
@@ -369,10 +367,10 @@ fn _remove_var(k: &OsStr) {
369367
///
370368
/// The iterator element type is [`PathBuf`].
371369
///
372-
/// This structure is created by the [`std::env::split_paths`] function. See its
370+
/// This structure is created by [`env::split_paths()`]. See its
373371
/// documentation for more.
374372
///
375-
/// [`std::env::split_paths`]: split_paths
373+
/// [`env::split_paths()`]: split_paths
376374
#[stable(feature = "env", since = "1.0.0")]
377375
pub struct SplitPaths<'a> {
378376
inner: os_imp::SplitPaths<'a>,
@@ -423,9 +421,9 @@ impl fmt::Debug for SplitPaths<'_> {
423421
}
424422

425423
/// The error type for operations on the `PATH` variable. Possibly returned from
426-
/// the [`env::join_paths`] function.
424+
/// [`env::join_paths()`].
427425
///
428-
/// [`env::join_paths`]: join_paths
426+
/// [`env::join_paths()`]: join_paths
429427
#[derive(Debug)]
430428
#[stable(feature = "env", since = "1.0.0")]
431429
pub struct JoinPathsError {
@@ -460,7 +458,8 @@ pub struct JoinPathsError {
460458
/// }
461459
/// ```
462460
///
463-
/// Joining a path containing a colon on a Unix-like platform results in an error:
461+
/// Joining a path containing a colon on a Unix-like platform results in an
462+
/// error:
464463
///
465464
/// ```
466465
/// # if cfg!(unix) {
@@ -472,8 +471,8 @@ pub struct JoinPathsError {
472471
/// # }
473472
/// ```
474473
///
475-
/// Using `env::join_paths` with [`env::split_paths`] to append an item to the `PATH` environment
476-
/// variable:
474+
/// Using `env::join_paths()` with [`env::split_paths()`] to append an item to
475+
/// the `PATH` environment variable:
477476
///
478477
/// ```
479478
/// use std::env;
@@ -491,7 +490,7 @@ pub struct JoinPathsError {
491490
/// }
492491
/// ```
493492
///
494-
/// [`env::split_paths`]: split_paths
493+
/// [`env::split_paths()`]: split_paths
495494
#[stable(feature = "env", since = "1.0.0")]
496495
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
497496
where
@@ -664,14 +663,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
664663
/// An iterator over the arguments of a process, yielding a [`String`] value for
665664
/// each argument.
666665
///
667-
/// This struct is created by the [`std::env::args`] function. See its
668-
/// documentation for more.
666+
/// This struct is created by [`env::args()`]. See its documentation
667+
/// for more.
669668
///
670669
/// The first element is traditionally the path of the executable, but it can be
671670
/// set to arbitrary text, and may not even exist. This means this property
672671
/// should not be relied upon for security purposes.
673672
///
674-
/// [`std::env::args`]: args
673+
/// [`env::args()`]: args
675674
#[stable(feature = "env", since = "1.0.0")]
676675
pub struct Args {
677676
inner: ArgsOs,
@@ -680,14 +679,14 @@ pub struct Args {
680679
/// An iterator over the arguments of a process, yielding an [`OsString`] value
681680
/// for each argument.
682681
///
683-
/// This struct is created by the [`std::env::args_os`] function. See its
684-
/// documentation for more.
682+
/// This struct is created by [`env::args_os()`]. See its documentation
683+
/// for more.
685684
///
686685
/// The first element is traditionally the path of the executable, but it can be
687686
/// set to arbitrary text, and may not even exist. This means this property
688687
/// should not be relied upon for security purposes.
689688
///
690-
/// [`std::env::args_os`]: args_os
689+
/// [`env::args_os()`]: args_os
691690
#[stable(feature = "env", since = "1.0.0")]
692691
pub struct ArgsOs {
693692
inner: sys::args::Args,

0 commit comments

Comments
 (0)