Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use env::func(), not 'the function env::func' in docs for std::env #75945

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 25 additions & 26 deletions library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,19 @@ pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {

/// An iterator over a snapshot of the environment variables of this process.
///
/// This structure is created by the [`std::env::vars`] function. See its
/// documentation for more.
/// This structure is created by [`env::vars()`]. See its documentation for more.
pickfire marked this conversation as resolved.
Show resolved Hide resolved
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`std::env::vars`]: vars
/// [`env::vars()`]: vars
#[stable(feature = "env", since = "1.0.0")]
pub struct Vars {
inner: VarsOs,
}

/// An iterator over a snapshot of the environment variables of this process.
///
/// This structure is created by the [`std::env::vars_os`] function. See
/// its documentation for more.
/// This structure is created by [`env::vars_os()`]. See its documentation for more.
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`std::env::vars_os`]: vars_os
/// [`env::vars()`]: vars
pickfire marked this conversation as resolved.
Show resolved Hide resolved
#[stable(feature = "env", since = "1.0.0")]
pub struct VarsOs {
inner: os_imp::Env,
Expand All @@ -95,10 +93,8 @@ pub struct VarsOs {
/// # Panics
///
/// While iterating, the returned iterator will panic if any key or value in the
/// environment is not valid unicode. If this is not desired, consider using the
/// [`env::vars_os`] function.
///
/// [`env::vars_os`]: vars_os
/// environment is not valid unicode. If this is not desired, consider using
/// [`env::vars_os()`].
///
/// # Examples
///
Expand All @@ -111,6 +107,8 @@ pub struct VarsOs {
/// println!("{}: {}", key, value);
/// }
/// ```
///
/// [`env::vars_os()`]: vars_os
#[stable(feature = "env", since = "1.0.0")]
pub fn vars() -> Vars {
Vars { inner: vars_os() }
Expand Down Expand Up @@ -242,9 +240,9 @@ fn _var_os(key: &OsStr) -> Option<OsString> {
}

/// The error type for operations interacting with environment variables.
/// Possibly returned from the [`env::var`] function.
/// Possibly returned from [`env::var()`].
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`env::var`]: var
/// [`env::var()`]: var
#[derive(Debug, PartialEq, Eq, Clone)]
#[stable(feature = "env", since = "1.0.0")]
pub enum VarError {
Expand Down Expand Up @@ -369,10 +367,10 @@ fn _remove_var(k: &OsStr) {
///
/// The iterator element type is [`PathBuf`].
///
/// This structure is created by the [`std::env::split_paths`] function. See its
/// This structure is created by [`env::split_paths()`]. See its
/// documentation for more.
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`std::env::split_paths`]: split_paths
/// [`env::split_paths()`]: split_paths
#[stable(feature = "env", since = "1.0.0")]
pub struct SplitPaths<'a> {
inner: os_imp::SplitPaths<'a>,
Expand Down Expand Up @@ -423,9 +421,9 @@ impl fmt::Debug for SplitPaths<'_> {
}

/// The error type for operations on the `PATH` variable. Possibly returned from
/// the [`env::join_paths`] function.
/// [`env::join_paths()`].
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`env::join_paths`]: join_paths
/// [`env::join_paths()`]: join_paths
#[derive(Debug)]
#[stable(feature = "env", since = "1.0.0")]
pub struct JoinPathsError {
Expand Down Expand Up @@ -460,7 +458,8 @@ pub struct JoinPathsError {
/// }
/// ```
///
/// Joining a path containing a colon on a Unix-like platform results in an error:
/// Joining a path containing a colon on a Unix-like platform results in an
/// error:
///
/// ```
/// # if cfg!(unix) {
Expand All @@ -472,8 +471,8 @@ pub struct JoinPathsError {
/// # }
/// ```
///
/// Using `env::join_paths` with [`env::split_paths`] to append an item to the `PATH` environment
/// variable:
/// Using `env::join_paths()` with [`env::split_paths()`] to append an item to
pickfire marked this conversation as resolved.
Show resolved Hide resolved
/// the `PATH` environment variable:
///
/// ```
/// use std::env;
Expand All @@ -491,7 +490,7 @@ pub struct JoinPathsError {
/// }
/// ```
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`env::split_paths`]: split_paths
/// [`env::split_paths()`]: split_paths
#[stable(feature = "env", since = "1.0.0")]
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
where
Expand Down Expand Up @@ -664,14 +663,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
/// An iterator over the arguments of a process, yielding a [`String`] value for
/// each argument.
///
/// This struct is created by the [`std::env::args`] function. See its
/// documentation for more.
/// This struct is created by [`env::args()`]. See its documentation
/// for more.
///
/// The first element is traditionally the path of the executable, but it can be
/// set to arbitrary text, and may not even exist. This means this property
/// should not be relied upon for security purposes.
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`std::env::args`]: args
/// [`env::args()`]: args
#[stable(feature = "env", since = "1.0.0")]
pub struct Args {
inner: ArgsOs,
Expand All @@ -680,14 +679,14 @@ pub struct Args {
/// An iterator over the arguments of a process, yielding an [`OsString`] value
/// for each argument.
///
/// This struct is created by the [`std::env::args_os`] function. See its
/// documentation for more.
/// This struct is created by [`env::args_os()`]. See its documentation
/// for more.
///
/// The first element is traditionally the path of the executable, but it can be
/// set to arbitrary text, and may not even exist. This means this property
/// should not be relied upon for security purposes.
pickfire marked this conversation as resolved.
Show resolved Hide resolved
///
/// [`std::env::args_os`]: args_os
/// [`env::args_os()`]: args_os
#[stable(feature = "env", since = "1.0.0")]
pub struct ArgsOs {
inner: sys::args::Args,
Expand Down