diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2015-04-13 10:21:32 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2015-04-13 13:57:51 -0400 |
| commit | 6fa16d6a473415415cb87a1fe6754aace32cbb1c (patch) | |
| tree | 6009800c0605908efff7b33c6711b5924d4f70d0 /src/libstd | |
| parent | 588d37c653ddac491c2c1cb8974f56781533b173 (diff) | |
| download | rust-6fa16d6a473415415cb87a1fe6754aace32cbb1c.tar.gz rust-6fa16d6a473415415cb87a1fe6754aace32cbb1c.zip | |
pluralize doc comment verbs and add missing periods
Diffstat (limited to 'src/libstd')
45 files changed, 241 insertions, 241 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 20ad71a4bf8..a2ba8c4c1ba 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -23,12 +23,12 @@ use mem; #[unstable(feature = "std_misc", reason = "would prefer to do this in a more general way")] pub trait OwnedAsciiExt { - /// Convert the string to ASCII upper case: + /// Converts the string to ASCII upper case: /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', /// but non-ASCII letters are unchanged. fn into_ascii_uppercase(self) -> Self; - /// Convert the string to ASCII lower case: + /// Converts the string to ASCII lower case: /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z', /// but non-ASCII letters are unchanged. fn into_ascii_lowercase(self) -> Self; @@ -41,7 +41,7 @@ pub trait AsciiExt { #[stable(feature = "rust1", since = "1.0.0")] type Owned; - /// Check if within the ASCII range. + /// Checks if within the ASCII range. /// /// # Examples /// @@ -95,7 +95,7 @@ pub trait AsciiExt { #[stable(feature = "rust1", since = "1.0.0")] fn to_ascii_lowercase(&self) -> Self::Owned; - /// Check that two strings are an ASCII case-insensitive match. + /// Checks that two strings are an ASCII case-insensitive match. /// /// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`, /// but without allocating and copying temporary strings. @@ -117,7 +117,7 @@ pub trait AsciiExt { #[stable(feature = "rust1", since = "1.0.0")] fn eq_ignore_ascii_case(&self, other: &Self) -> bool; - /// Convert this type to its ASCII upper case equivalent in-place. + /// Converts this type to its ASCII upper case equivalent in-place. /// /// See `to_ascii_uppercase` for more information. /// @@ -136,7 +136,7 @@ pub trait AsciiExt { #[unstable(feature = "ascii")] fn make_ascii_uppercase(&mut self); - /// Convert this type to its ASCII lower case equivalent in-place. + /// Converts this type to its ASCII lower case equivalent in-place. /// /// See `to_ascii_lowercase` for more information. /// diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 54a3a055768..e507146bcb3 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -506,7 +506,7 @@ impl<K, V, S> HashMap<K, V, S> } impl<K: Hash + Eq, V> HashMap<K, V, RandomState> { - /// Create an empty HashMap. + /// Creates an empty HashMap. /// /// # Examples /// @@ -563,7 +563,7 @@ impl<K, V, S> HashMap<K, V, S> } } - /// Create an empty HashMap with space for at least `capacity` + /// Creates an empty HashMap with space for at least `capacity` /// elements, using `hasher` to hash the keys. /// /// Warning: `hasher` is normally randomly generated, and @@ -1596,7 +1596,7 @@ pub struct RandomState { #[unstable(feature = "std_misc", reason = "hashing an hash maps may be altered")] impl RandomState { - /// Construct a new `RandomState` that is initialized with random keys. + /// Constructs a new `RandomState` that is initialized with random keys. #[inline] #[allow(deprecated)] pub fn new() -> RandomState { diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index f897d565321..6b0546b1ee7 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -111,7 +111,7 @@ pub struct HashSet<T, S = RandomState> { } impl<T: Hash + Eq> HashSet<T, RandomState> { - /// Create an empty HashSet. + /// Creates an empty HashSet. /// /// # Examples /// @@ -125,7 +125,7 @@ impl<T: Hash + Eq> HashSet<T, RandomState> { HashSet::with_capacity(INITIAL_CAPACITY) } - /// Create an empty HashSet with space for at least `n` elements in + /// Creates an empty HashSet with space for at least `n` elements in /// the hash table. /// /// # Examples @@ -166,7 +166,7 @@ impl<T, S> HashSet<T, S> HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state) } - /// Create an empty HashSet with space for at least `capacity` + /// Creates an empty HashSet with space for at least `capacity` /// elements in the hash table, using `hasher` to hash the keys. /// /// Warning: `hasher` is normally randomly generated, and @@ -402,7 +402,7 @@ impl<T, S> HashSet<T, S> Union { iter: self.iter().chain(other.difference(self)) } } - /// Return the number of elements in the set + /// Returns the number of elements in the set. /// /// # Examples /// @@ -417,7 +417,7 @@ impl<T, S> HashSet<T, S> #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> usize { self.map.len() } - /// Returns true if the set contains no elements + /// Returns true if the set contains no elements. /// /// # Examples /// diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index e76d5460eb0..c69df6435c4 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -105,7 +105,7 @@ impl DynamicLibrary { } } - /// Access the value at the symbol of the dynamic library + /// Accesses the value at the symbol of the dynamic library. pub unsafe fn symbol<T>(&self, symbol: &str) -> Result<*mut T, String> { // This function should have a lifetime constraint of 'a on // T but that feature is still unimplemented diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 931cf46a58f..bcc109a71cb 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -261,7 +261,7 @@ pub fn set_var<K: ?Sized, V: ?Sized>(k: &K, v: &V) os_imp::setenv(k.as_ref(), v.as_ref()) } -/// Remove an environment variable from the environment of the currently running process. +/// Removes an environment variable from the environment of the currently running process. /// /// # Examples /// diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index de91e5f3268..1910530c63a 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -133,7 +133,7 @@ pub struct CStr { pub struct NulError(usize, Vec<u8>); impl CString { - /// Create a new C-compatible string from a container of bytes. + /// Creates a new C-compatible string from a container of bytes. /// /// This method will consume the provided data and use the underlying bytes /// to construct a new string, ensuring that there is a trailing 0 byte. @@ -169,7 +169,7 @@ impl CString { } } - /// Create a C-compatible string from a byte vector without checking for + /// Creates a C-compatible string from a byte vector without checking for /// interior 0 bytes. /// /// This method is equivalent to `from_vec` except that no runtime assertion @@ -258,7 +258,7 @@ impl From<NulError> for old_io::IoError { } impl CStr { - /// Cast a raw C string to a safe C string wrapper. + /// Casts a raw C string to a safe C string wrapper. /// /// This function will cast the provided `ptr` to the `CStr` wrapper which /// allows inspection and interoperation of non-owned C strings. This method @@ -301,7 +301,7 @@ impl CStr { mem::transmute(slice::from_raw_parts(ptr, len as usize + 1)) } - /// Return the inner pointer to this C string. + /// Returns the inner pointer to this C string. /// /// The returned pointer will be valid for as long as `self` is and points /// to a contiguous region of memory terminated with a 0 byte to represent @@ -311,7 +311,7 @@ impl CStr { self.inner.as_ptr() } - /// Convert this C string to a byte slice. + /// Converts this C string to a byte slice. /// /// This function will calculate the length of this string (which normally /// requires a linear amount of work to be done) and then return the @@ -329,7 +329,7 @@ impl CStr { &bytes[..bytes.len() - 1] } - /// Convert this C string to a byte slice containing the trailing 0 byte. + /// Converts this C string to a byte slice containing the trailing 0 byte. /// /// This function is the equivalent of `to_bytes` except that it will retain /// the trailing nul instead of chopping it off. diff --git a/src/libstd/ffi/mod.rs b/src/libstd/ffi/mod.rs index 1b7e913d46c..99becb67a5a 100644 --- a/src/libstd/ffi/mod.rs +++ b/src/libstd/ffi/mod.rs @@ -25,6 +25,6 @@ mod os_str; /// Freely convertible to an `&OsStr` slice. #[unstable(feature = "std_misc")] pub trait AsOsStr { - /// Convert to an `&OsStr` slice. + /// Converts to an `&OsStr` slice. fn as_os_str(&self) -> &OsStr; } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index ab20efe25eb..5e61b29f34c 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -69,7 +69,7 @@ impl OsString { OsString { inner: Buf::from_string(String::new()) } } - /// Construct an `OsString` from a byte sequence. + /// Constructs an `OsString` from a byte sequence. /// /// # Platform behavior /// @@ -94,13 +94,13 @@ impl OsString { from_bytes_inner(bytes.into()) } - /// Convert to an `OsStr` slice. + /// Converts to an `OsStr` slice. #[stable(feature = "rust1", since = "1.0.0")] pub fn as_os_str(&self) -> &OsStr { self } - /// Convert the `OsString` into a `String` if it contains valid Unicode data. + /// Converts the `OsString` into a `String` if it contains valid Unicode data. /// /// On failure, ownership of the original `OsString` is returned. #[stable(feature = "rust1", since = "1.0.0")] @@ -108,7 +108,7 @@ impl OsString { self.inner.into_string().map_err(|buf| OsString { inner: buf} ) } - /// Extend the string with the given `&OsStr` slice. + /// Extends the string with the given `&OsStr` slice. #[stable(feature = "rust1", since = "1.0.0")] pub fn push<T: AsRef<OsStr>>(&mut self, s: T) { self.inner.push_slice(&s.as_ref().inner) @@ -221,13 +221,13 @@ impl Hash for OsString { } impl OsStr { - /// Coerce into an `OsStr` slice. + /// Coerces into an `OsStr` slice. #[stable(feature = "rust1", since = "1.0.0")] pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &OsStr { s.as_ref() } - /// Coerce directly from a `&str` slice to a `&OsStr` slice. + /// Coerces directly from a `&str` slice to a `&OsStr` slice. #[stable(feature = "rust1", since = "1.0.0")] #[deprecated(since = "1.0.0", reason = "use `OsStr::new` instead")] @@ -235,7 +235,7 @@ impl OsStr { unsafe { mem::transmute(Slice::from_str(s)) } } - /// Yield a `&str` slice if the `OsStr` is valid unicode. + /// Yields a `&str` slice if the `OsStr` is valid unicode. /// /// This conversion may entail doing a check for UTF-8 validity. #[stable(feature = "rust1", since = "1.0.0")] @@ -243,7 +243,7 @@ impl OsStr { self.inner.to_str() } - /// Convert an `OsStr` to a `Cow<str>`. + /// Converts an `OsStr` to a `Cow<str>`. /// /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. #[stable(feature = "rust1", since = "1.0.0")] @@ -251,13 +251,13 @@ impl OsStr { self.inner.to_string_lossy() } - /// Copy the slice into an owned `OsString`. + /// Copies the slice into an owned `OsString`. #[stable(feature = "rust1", since = "1.0.0")] pub fn to_os_string(&self) -> OsString { OsString { inner: self.inner.to_owned() } } - /// Yield this `OsStr` as a byte slice. + /// Yields this `OsStr` as a byte slice. /// /// # Platform behavior /// @@ -275,7 +275,7 @@ impl OsStr { } } - /// Create a `CString` containing this `OsStr` data. + /// Creates a `CString` containing this `OsStr` data. /// /// Fails if the `OsStr` contains interior nulls. /// @@ -287,7 +287,7 @@ impl OsStr { self.to_bytes().and_then(|b| CString::new(b).ok()) } - /// Get the underlying byte representation. + /// Gets the underlying byte representation. /// /// Note: it is *crucial* that this API is private, to avoid /// revealing the internal, platform-specific encodings. diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 914830d9dcf..cfa711db84d 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -171,7 +171,7 @@ impl File { OpenOptions::new().read(true).open(path) } - /// Open a file in write-only mode. + /// Opens a file in write-only mode. /// /// This function will create a file if it does not exist, /// and will truncate it if it does. @@ -201,7 +201,7 @@ impl File { self.path.as_ref().map(|p| &**p) } - /// Attempt to sync all OS-internal metadata to disk. + /// Attempts to sync all OS-internal metadata to disk. /// /// This function will attempt to ensure that all in-core data reaches the /// filesystem before returning. @@ -362,7 +362,7 @@ impl OpenOptions { OpenOptions(fs_imp::OpenOptions::new()) } - /// Set the option for read access. + /// Sets the option for read access. /// /// This option, when true, will indicate that the file should be /// `read`-able if opened. @@ -379,7 +379,7 @@ impl OpenOptions { self.0.read(read); self } - /// Set the option for write access. + /// Sets the option for write access. /// /// This option, when true, will indicate that the file should be /// `write`-able if opened. @@ -396,7 +396,7 @@ impl OpenOptions { self.0.write(write); self } - /// Set the option for the append mode. + /// Sets the option for the append mode. /// /// This option, when true, means that writes will append to a file instead /// of overwriting previous contents. @@ -413,7 +413,7 @@ impl OpenOptions { self.0.append(append); self } - /// Set the option for truncating a previous file. + /// Sets the option for truncating a previous file. /// /// If a file is successfully opened with this option set it will truncate /// the file to 0 length if it already exists. @@ -430,7 +430,7 @@ impl OpenOptions { self.0.truncate(truncate); self } - /// Set the option for creating a new file. + /// Sets the option for creating a new file. /// /// This option indicates whether a new file will be created if the file /// does not yet already exist. @@ -447,7 +447,7 @@ impl OpenOptions { self.0.create(create); self } - /// Open a file at `path` with the options specified by `self`. + /// Opens a file at `path` with the options specified by `self`. /// /// # Errors /// @@ -587,7 +587,7 @@ impl Permissions { #[stable(feature = "rust1", since = "1.0.0")] pub fn readonly(&self) -> bool { self.0.readonly() } - /// Modify the readonly flag for this set of permissions. + /// Modifies the readonly flag for this set of permissions. /// /// This operation does **not** modify the filesystem. To modify the /// filesystem use the `fs::set_permissions` function. @@ -670,7 +670,7 @@ impl DirEntry { pub fn path(&self) -> PathBuf { self.0.path() } } -/// Remove a file from the underlying filesystem. +/// Removes a file from the underlying filesystem. /// /// Note that, just because an unlink call was successful, it is not /// guaranteed that a file is immediately deleted (e.g. depending on @@ -856,7 +856,7 @@ pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> { fs_imp::readlink(path.as_ref()) } -/// Create a new, empty directory at the provided path +/// Creates a new, empty directory at the provided path /// /// # Errors /// @@ -906,7 +906,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { create_dir(path) } -/// Remove an existing, empty directory +/// Removes an existing, empty directory. /// /// # Errors /// @@ -1058,7 +1058,7 @@ impl Iterator for WalkDir { reason = "the precise set of methods exposed on this trait may \ change and some methods may be removed")] pub trait PathExt { - /// Get information on the file, directory, etc at this path. + /// Gets information on the file, directory, etc at this path. /// /// Consult the `fs::stat` documentation for more info. /// diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 6433c29bb9d..72743106abf 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -34,21 +34,21 @@ pub struct Cursor<T> { } impl<T> Cursor<T> { - /// Create a new cursor wrapping the provided underlying I/O object. + /// Creates a new cursor wrapping the provided underlying I/O object. #[stable(feature = "rust1", since = "1.0.0")] pub fn new(inner: T) -> Cursor<T> { Cursor { pos: 0, inner: inner } } - /// Consume this cursor, returning the underlying value. + /// Consumes this cursor, returning the underlying value. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_inner(self) -> T { self.inner } - /// Get a reference to the underlying value in this cursor. + /// Gets a reference to the underlying value in this cursor. #[stable(feature = "rust1", since = "1.0.0")] pub fn get_ref(&self) -> &T { &self.inner } - /// Get a mutable reference to the underlying value in this cursor. + /// Gets a mutable reference to the underlying value in this cursor. /// /// Care should be taken to avoid modifying the internal I/O state of the /// underlying value as it may corrupt this cursor's position. diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 7428d0a8e35..a49039b1ec4 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -191,7 +191,7 @@ impl Error { } } - /// Return the corresponding `ErrorKind` for this error. + /// Returns the corresponding `ErrorKind` for this error. #[stable(feature = "rust1", since = "1.0.0")] pub fn kind(&self) -> ErrorKind { match self.repr { diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index f0f37117ed3..ef836a19461 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -220,14 +220,14 @@ pub trait Read { append_to_string(buf, |b| read_to_end(self, b)) } - /// Create a "by reference" adaptor for this instance of `Read`. + /// Creates a "by reference" adaptor for this instance of `Read`. /// /// The returned adaptor also implements `Read` and will simply borrow this /// current reader. #[stable(feature = "rust1", since = "1.0.0")] fn by_ref(&mut self) -> &mut Self where Self: Sized { self } - /// Transform this `Read` instance to an `Iterator` over its bytes. + /// Transforms this `Read` instance to an `Iterator` over its bytes. /// /// The returned type implements `Iterator` where the `Item` is `Result<u8, /// R::Err>`. The yielded item is `Ok` if a byte was successfully read and @@ -238,7 +238,7 @@ pub trait Read { Bytes { inner: self } } - /// Transform this `Read` instance to an `Iterator` over `char`s. + /// Transforms this `Read` instance to an `Iterator` over `char`s. /// /// This adaptor will attempt to interpret this reader as an UTF-8 encoded /// sequence of characters. The returned iterator will return `None` once @@ -255,7 +255,7 @@ pub trait Read { Chars { inner: self } } - /// Create an adaptor which will chain this stream with another. + /// Creates an adaptor which will chain this stream with another. /// /// The returned `Read` instance will first read all bytes from this object /// until EOF is encountered. Afterwards the output is equivalent to the @@ -265,7 +265,7 @@ pub trait Read { Chain { first: self, second: next, done_first: false } } - /// Create an adaptor which will read at most `limit` bytes from it. + /// Creates an adaptor which will read at most `limit` bytes from it. /// /// This function returns a new instance of `Read` which will read at most /// `limit` bytes, after which it will always return EOF (`Ok(0)`). Any @@ -406,7 +406,7 @@ pub trait Write { } } - /// Create a "by reference" adaptor for this instance of `Write`. + /// Creates a "by reference" adaptor for this instance of `Write`. /// /// The returned adaptor also implements `Write` and will simply borrow this /// current writer. diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 2850d92e34d..cd6af77daa9 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -45,7 +45,7 @@ struct StdoutRaw(stdio::Stdout); /// the `std::io::stdio::stderr_raw` function. struct StderrRaw(stdio::Stderr); -/// Construct a new raw handle to the standard input of this process. +/// Constructs a new raw handle to the standard input of this process. /// /// The returned handle does not interact with any other handles created nor /// handles returned by `std::io::stdin`. Data buffered by the `std::io::stdin` @@ -54,7 +54,7 @@ struct StderrRaw(stdio::Stderr); /// The returned handle has no external synchronization or buffering. fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) } -/// Construct a new raw handle to the standard input stream of this process. +/// Constructs a new raw handle to the standard input stream of this process. /// /// The returned handle does not interact with any other handles created nor /// handles returned by `std::io::stdout`. Note that data is buffered by the @@ -65,7 +65,7 @@ fn stdin_raw() -> StdinRaw { StdinRaw(stdio::Stdin::new()) } /// top. fn stdout_raw() -> StdoutRaw { StdoutRaw(stdio::Stdout::new()) } -/// Construct a new raw handle to the standard input stream of this process. +/// Constructs a new raw handle to the standard input stream of this process. /// /// The returned handle does not interact with any other handles created nor /// handles returned by `std::io::stdout`. @@ -109,7 +109,7 @@ pub struct StdinLock<'a> { inner: MutexGuard<'a, BufReader<StdinRaw>>, } -/// Create a new handle to the global standard input stream of this process. +/// Creates a new handle to the global standard input stream of this process. /// /// The handle returned refers to a globally shared buffer between all threads. /// Access is synchronized and can be explicitly controlled with the `lock()` @@ -139,7 +139,7 @@ pub fn stdin() -> Stdin { } impl Stdin { - /// Lock this handle to the standard input stream, returning a readable + /// Locks this handle to the standard input stream, returning a readable /// guard. /// /// The lock is released when the returned lock goes out of scope. The @@ -243,7 +243,7 @@ pub fn stdout() -> Stdout { } impl Stdout { - /// Lock this handle to the standard output stream, returning a writable + /// Locks this handle to the standard output stream, returning a writable /// guard. /// /// The lock is released when the returned lock goes out of scope. The @@ -315,7 +315,7 @@ pub fn stderr() -> Stderr { } impl Stderr { - /// Lock this handle to the standard error stream, returning a writable + /// Locks this handle to the standard error stream, returning a writable /// guard. /// /// The lock is released when the returned lock goes out of scope. The diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c8b19287477..8d4af4689af 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -58,7 +58,7 @@ pub enum Ipv6MulticastScope { } impl Ipv4Addr { - /// Create a new IPv4 address from four eight-bit octets. + /// Creates a new IPv4 address from four eight-bit octets. /// /// The result will represent the IP address a.b.c.d #[stable(feature = "rust1", since = "1.0.0")] @@ -127,7 +127,7 @@ impl Ipv4Addr { self.octets()[0] >= 224 && self.octets()[0] <= 239 } - /// Convert this address to an IPv4-compatible IPv6 address + /// Converts this address to an IPv4-compatible IPv6 address /// /// a.b.c.d becomes ::a.b.c.d #[stable(feature = "rust1", since = "1.0.0")] @@ -137,7 +137,7 @@ impl Ipv4Addr { ((self.octets()[2] as u16) << 8) | self.octets()[3] as u16) } - /// Convert this address to an IPv4-mapped IPv6 address + /// Converts this address to an IPv4-mapped IPv6 address /// /// a.b.c.d becomes ::ffff:a.b.c.d #[stable(feature = "rust1", since = "1.0.0")] @@ -220,7 +220,7 @@ impl FromInner<libc::in_addr> for Ipv4Addr { } impl Ipv6Addr { - /// Create a new IPv6 address from eight 16-bit segments. + /// Creates a new IPv6 address from eight 16-bit segments. /// /// The result will represent the IP address a:b:c:d:e:f:g:h #[stable(feature = "rust1", since = "1.0.0")] @@ -234,7 +234,7 @@ impl Ipv6Addr { } } - /// Return the eight 16-bit segments that make up this address + /// Returns the eight 16-bit segments that make up this address #[stable(feature = "rust1", since = "1.0.0")] pub fn segments(&self) -> [u16; 8] { [ntoh(self.inner.s6_addr[0]), @@ -324,7 +324,7 @@ impl Ipv6Addr { (self.segments()[0] & 0xff00) == 0xff00 } - /// Convert this address to an IPv4 address. Returns None if this address is + /// Converts this address to an IPv4 address. Returns None if this address is /// neither IPv4-compatible or IPv4-mapped. /// /// ::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 2da6f7420ac..209a0032fb4 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -82,7 +82,7 @@ pub struct TcpListener(net_imp::TcpListener); pub struct Incoming<'a> { listener: &'a TcpListener } impl TcpStream { - /// Open a TCP connection to a remote host. + /// Opens a TCP connection to a remote host. /// /// `addr` is an address of the remote host. Anything which implements /// `ToSocketAddrs` trait can be supplied for the address; see this trait @@ -104,7 +104,7 @@ impl TcpStream { self.0.socket_addr() } - /// Shut down the read, write, or both halves of this connection. + /// Shuts down the read, write, or both halves of this connection. /// /// This function will cause all pending and future I/O on the specified /// portions to return immediately with an appropriate value (see the @@ -114,7 +114,7 @@ impl TcpStream { self.0.shutdown(how) } - /// Create a new independently owned handle to the underlying socket. + /// Creates a new independently owned handle to the underlying socket. /// /// The returned `TcpStream` is a reference to the same stream that this /// object references. Both handles will read and write the same stream of @@ -190,7 +190,7 @@ impl TcpListener { self.0.socket_addr() } - /// Create a new independently owned handle to the underlying socket. + /// Creates a new independently owned handle to the underlying socket. /// /// The returned `TcpListener` is a reference to the same socket that this /// object references. Both handles can be used to accept incoming diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index bec9c09bc31..1955b895300 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -85,7 +85,7 @@ impl UdpSocket { self.0.socket_addr() } - /// Create a new independently owned handle to the underlying socket. + /// Creates a new independently owned handle to the underlying socket. /// /// The returned `UdpSocket` is a reference to the same socket that this /// object references. Both handles will read and write the same port, and @@ -100,7 +100,7 @@ impl UdpSocket { self.0.set_broadcast(on) } - /// Set the multicast loop flag to the specified value + /// Sets the multicast loop flag to the specified value /// /// This lets multicast packets loop back to local sockets (if enabled) pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> { diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 6128469c60e..736f6d2f4f4 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -527,7 +527,7 @@ impl f32 { #[inline] pub fn round(self) -> f32 { num::Float::round(self) } - /// Return the integer part of a number. + /// Returns the integer part of a number. /// /// ``` /// let f = 3.3_f32; @@ -666,7 +666,7 @@ impl f32 { #[inline] pub fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) } - /// Take the reciprocal (inverse) of a number, `1/x`. + /// Takes the reciprocal (inverse) of a number, `1/x`. /// /// ``` /// use std::f32; @@ -680,7 +680,7 @@ impl f32 { #[inline] pub fn recip(self) -> f32 { num::Float::recip(self) } - /// Raise a number to an integer power. + /// Raises a number to an integer power. /// /// Using this function is generally faster than using `powf` /// @@ -696,7 +696,7 @@ impl f32 { #[inline] pub fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) } - /// Raise a number to a floating point power. + /// Raises a number to a floating point power. /// /// ``` /// use std::f32; @@ -710,7 +710,7 @@ impl f32 { #[inline] pub fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) } - /// Take the square root of a number. + /// Takes the square root of a number. /// /// Returns NaN if `self` is a negative number. /// @@ -729,7 +729,7 @@ impl f32 { #[inline] pub fn sqrt(self) -> f32 { num::Float::sqrt(self) } - /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. + /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` /// # #![feature(std_misc)] @@ -852,7 +852,7 @@ impl f32 { #[inline] pub fn log10(self) -> f32 { num::Float::log10(self) } - /// Convert radians to degrees. + /// Converts radians to degrees. /// /// ``` /// # #![feature(std_misc)] @@ -868,7 +868,7 @@ impl f32 { #[inline] pub fn to_degrees(self) -> f32 { num::Float::to_degrees(self) } - /// Convert degrees to radians. + /// Converts degrees to radians. /// /// ``` /// # #![feature(std_misc)] @@ -1003,7 +1003,7 @@ impl f32 { unsafe { cmath::fdimf(self, other) } } - /// Take the cubic root of a number. + /// Takes the cubic root of a number. /// /// ``` /// use std::f32; @@ -1021,7 +1021,7 @@ impl f32 { unsafe { cmath::cbrtf(self) } } - /// Calculate the length of the hypotenuse of a right-angle triangle given + /// Calculates the length of the hypotenuse of a right-angle triangle given /// legs of length `x` and `y`. /// /// ``` diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 794853f6f70..bb9067eca13 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -534,7 +534,7 @@ impl f64 { #[inline] pub fn round(self) -> f64 { num::Float::round(self) } - /// Return the integer part of a number. + /// Returns the integer part of a number. /// /// ``` /// let f = 3.3_f64; @@ -671,7 +671,7 @@ impl f64 { #[inline] pub fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) } - /// Take the reciprocal (inverse) of a number, `1/x`. + /// Takes the reciprocal (inverse) of a number, `1/x`. /// /// ``` /// let x = 2.0_f64; @@ -683,7 +683,7 @@ impl f64 { #[inline] pub fn recip(self) -> f64 { num::Float::recip(self) } - /// Raise a number to an integer power. + /// Raises a number to an integer power. /// /// Using this function is generally faster than using `powf` /// @@ -697,7 +697,7 @@ impl f64 { #[inline] pub fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) } - /// Raise a number to a floating point power. + /// Raises a number to a floating point power. /// /// ``` /// let x = 2.0_f64; @@ -709,7 +709,7 @@ impl f64 { #[inline] pub fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) } - /// Take the square root of a number. + /// Takes the square root of a number. /// /// Returns NaN if `self` is a negative number. /// @@ -726,7 +726,7 @@ impl f64 { #[inline] pub fn sqrt(self) -> f64 { num::Float::sqrt(self) } - /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. + /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` /// # #![feature(std_misc)] @@ -835,7 +835,7 @@ impl f64 { #[inline] pub fn log10(self) -> f64 { num::Float::log10(self) } - /// Convert radians to degrees. + /// Converts radians to degrees. /// /// ``` /// use std::f64::consts; @@ -850,7 +850,7 @@ impl f64 { #[inline] pub fn to_degrees(self) -> f64 { num::Float::to_degrees(self) } - /// Convert degrees to radians. + /// Converts degrees to radians. /// /// ``` /// use std::f64::consts; @@ -978,7 +978,7 @@ impl f64 { unsafe { cmath::fdim(self, other) } } - /// Take the cubic root of a number. + /// Takes the cubic root of a number. /// /// ``` /// let x = 8.0_f64; @@ -994,7 +994,7 @@ impl f64 { unsafe { cmath::cbrt(self) } } - /// Calculate the length of the hypotenuse of a right-angle triangle given + /// Calculates the length of the hypotenuse of a right-angle triangle given /// legs of length `x` and `y`. /// /// ``` diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index ea516e5b20b..e0b9c720dbb 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -383,7 +383,7 @@ pub trait Float /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn round(self) -> Self; - /// Return the integer part of a number. + /// Returns the integer part of a number. /// /// ``` /// use std::num::Float; @@ -509,7 +509,7 @@ pub trait Float #[unstable(feature = "std_misc", reason = "unsure about its place in the world")] fn mul_add(self, a: Self, b: Self) -> Self; - /// Take the reciprocal (inverse) of a number, `1/x`. + /// Takes the reciprocal (inverse) of a number, `1/x`. /// /// ``` /// # #![feature(std_misc)] @@ -524,7 +524,7 @@ pub trait Float reason = "unsure about its place in the world")] fn recip(self) -> Self; - /// Raise a number to an integer power. + /// Raises a number to an integer power. /// /// Using this function is generally faster than using `powf` /// @@ -538,7 +538,7 @@ pub trait Float /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn powi(self, n: i32) -> Self; - /// Raise a number to a floating point power. + /// Raises a number to a floating point power. /// /// ``` /// use std::num::Float; @@ -550,7 +550,7 @@ pub trait Float /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn powf(self, n: Self) -> Self; - /// Take the square root of a number. + /// Takes the square root of a number. /// /// Returns NaN if `self` is a negative number. /// @@ -569,7 +569,7 @@ pub trait Float #[stable(feature = "rust1", since = "1.0.0")] fn sqrt(self) -> Self; - /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. + /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` /// # #![feature(std_misc)] @@ -679,7 +679,7 @@ pub trait Float #[stable(feature = "rust1", since = "1.0.0")] fn log10(self) -> Self; - /// Convert radians to degrees. + /// Converts radians to degrees. /// /// ``` /// use std::num::Float; @@ -693,7 +693,7 @@ pub trait Float /// ``` #[unstable(feature = "std_misc", reason = "desirability is unclear")] fn to_degrees(self) -> Self; - /// Convert degrees to radians. + /// Converts degrees to radians. /// /// ``` /// # #![feature(std_misc)] @@ -807,7 +807,7 @@ pub trait Float /// ``` #[unstable(feature = "std_misc", reason = "may be renamed")] fn abs_sub(self, other: Self) -> Self; - /// Take the cubic root of a number. + /// Takes the cubic root of a number. /// /// ``` /// # #![feature(std_misc)] @@ -822,7 +822,7 @@ pub trait Float /// ``` #[unstable(feature = "std_misc", reason = "may be renamed")] fn cbrt(self) -> Self; - /// Calculate the length of the hypotenuse of a right-angle triangle given + /// Calculates the length of the hypotenuse of a right-angle triangle given /// legs of length `x` and `y`. /// /// ``` diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 4471b5afa84..cdc5cecbf38 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -312,7 +312,7 @@ impl<'a> Prefix<'a> { } - /// Determine if the prefix is verbatim, i.e. begins `\\?\`. + /// Determines if the prefix is verbatim, i.e. begins `\\?\`. #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn is_verbatim(&self) -> bool { @@ -341,7 +341,7 @@ impl<'a> Prefix<'a> { // Exposed parsing helpers //////////////////////////////////////////////////////////////////////////////// -/// Determine whether the character is one of the permitted path +/// Determines whether the character is one of the permitted path /// separators for the current platform. /// /// # Examples @@ -524,7 +524,7 @@ pub enum Component<'a> { } impl<'a> Component<'a> { - /// Extract the underlying `OsStr` slice + /// Extracts the underlying `OsStr` slice #[stable(feature = "rust1", since = "1.0.0")] pub fn as_os_str(self) -> &'a OsStr { match self { @@ -629,7 +629,7 @@ impl<'a> Components<'a> { } } - /// Extract a slice corresponding to the portion of the path remaining for iteration. + /// Extracts a slice corresponding to the portion of the path remaining for iteration. /// /// # Examples /// @@ -750,7 +750,7 @@ impl<'a> AsRef<OsStr> for Components<'a> { } impl<'a> Iter<'a> { - /// Extract a slice corresponding to the portion of the path remaining for iteration. + /// Extracts a slice corresponding to the portion of the path remaining for iteration. #[stable(feature = "rust1", since = "1.0.0")] pub fn as_path(&self) -> &'a Path { self.inner.as_path() @@ -941,19 +941,19 @@ impl PathBuf { unsafe { mem::transmute(self) } } - /// Allocate an empty `PathBuf`. + /// Allocates an empty `PathBuf`. #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> PathBuf { PathBuf { inner: OsString::new() } } - /// Coerce to a `Path` slice. + /// Coerces to a `Path` slice. #[stable(feature = "rust1", since = "1.0.0")] pub fn as_path(&self) -> &Path { self } - /// Extend `self` with `path`. + /// Extends `self` with `path`. /// /// If `path` is absolute, it replaces the current path. /// @@ -1064,7 +1064,7 @@ impl PathBuf { true } - /// Consume the `PathBuf`, yielding its internal `OsString` storage + /// Consumes the `PathBuf`, yielding its internal `OsString` storage. #[stable(feature = "rust1", since = "1.0.0")] pub fn into_os_string(self) -> OsString { self.inner @@ -1254,7 +1254,7 @@ impl Path { unsafe { mem::transmute(s.as_ref()) } } - /// Yield the underlying `OsStr` slice. + /// Yields the underlying `OsStr` slice. /// /// # Examples /// @@ -1268,7 +1268,7 @@ impl Path { &self.inner } - /// Yield a `&str` slice if the `Path` is valid unicode. + /// Yields a `&str` slice if the `Path` is valid unicode. /// /// This conversion may entail doing a check for UTF-8 validity. /// @@ -1284,7 +1284,7 @@ impl Path { self.inner.to_str() } - /// Convert a `Path` to a `Cow<str>`. + /// Converts a `Path` to a `Cow<str>`. /// /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. /// @@ -1300,7 +1300,7 @@ impl Path { self.inner.to_string_lossy() } - /// Convert a `Path` to an owned `PathBuf`. + /// Converts a `Path` to an owned `PathBuf`. /// /// # Examples /// @@ -1477,7 +1477,7 @@ impl Path { iter_after(self.components().rev(), child.as_ref().components().rev()).is_some() } - /// Extract the stem (non-extension) portion of `self.file()`. + /// Extracts the stem (non-extension) portion of `self.file()`. /// /// The stem is: /// @@ -1500,7 +1500,7 @@ impl Path { self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after)) } - /// Extract the extension of `self.file()`, if possible. + /// Extracts the extension of `self.file()`, if possible. /// /// The extension is: /// @@ -1714,7 +1714,7 @@ impl cmp::Ord for Path { #[unstable(feature = "std_misc")] #[deprecated(since = "1.0.0", reason = "use std::convert::AsRef<Path> instead")] pub trait AsPath { - /// Convert to a `Path`. + /// Converts to a `Path`. #[unstable(feature = "std_misc")] fn as_path(&self) -> &Path; } diff --git a/src/libstd/process.rs b/src/libstd/process.rs index cac1540d0ec..7306dd38260 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -194,7 +194,7 @@ impl Command { self } - /// Set the working directory for the child process. + /// Sets the working directory for the child process. #[stable(feature = "process", since = "1.0.0")] pub fn current_dir<P: AsRef<path::Path>>(&mut self, dir: P) -> &mut Command { self.inner.cwd(dir.as_ref().as_ref()); @@ -396,7 +396,7 @@ impl ExitStatus { self.0.success() } - /// Return the exit code of the process, if any. + /// Returns the exit code of the process, if any. /// /// On Unix, this will return `None` if the process was terminated /// by a signal; `std::os::unix` provides an extension trait for @@ -453,7 +453,7 @@ impl Child { unsafe { self.handle.kill() } } - /// Wait for the child to exit completely, returning the status that it + /// Waits for the child to exit completely, returning the status that it /// exited with. This function will continue to have the same return value /// after it has been called at least once. /// @@ -474,7 +474,7 @@ impl Child { } } - /// Simultaneously wait for the child to exit and collect all remaining + /// Simultaneously waits for the child to exit and collect all remaining /// output on the stdout/stderr handles, returning a `Output` /// instance. /// diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index ebf4d337749..34fcf6cdadd 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -49,7 +49,7 @@ struct BarrierState { pub struct BarrierWaitResult(bool); impl Barrier { - /// Create a new barrier that can block a given number of threads. + /// Creates a new barrier that can block a given number of threads. /// /// A barrier will block `n`-1 threads which call `wait` and then wake up /// all threads at once when the `n`th thread calls `wait`. @@ -65,7 +65,7 @@ impl Barrier { } } - /// Block the current thread until all threads has rendezvoused here. + /// Blocks the current thread until all threads has rendezvoused here. /// /// Barriers are re-usable after all threads have rendezvoused once, and can /// be used continuously. @@ -97,7 +97,7 @@ impl Barrier { } impl BarrierWaitResult { - /// Return whether this thread from `wait` is the "leader thread". + /// Returns whether this thread from `wait` is the "leader thread". /// /// Only one thread will have `true` returned from their result, all other /// threads will have `false` returned. diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 654b33f1a57..fcb0d2c0b2d 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -102,7 +102,7 @@ impl Condvar { } } - /// Block the current thread until this condition variable receives a + /// Blocks the current thread until this condition variable receives a /// notification. /// /// This function will atomically unlock the mutex specified (represented by @@ -137,7 +137,7 @@ impl Condvar { } } - /// Wait on this condition variable for a notification, timing out after a + /// Waits on this condition variable for a notification, timing out after a /// specified duration. /// /// The semantics of this function are equivalent to `wait()` @@ -169,7 +169,7 @@ impl Condvar { self.wait_timeout_ms(guard, dur.num_milliseconds() as u32) } - /// Wait on this condition variable for a notification, timing out after a + /// Waits on this condition variable for a notification, timing out after a /// specified duration. /// /// The semantics of this function are equivalent to `wait_timeout` except @@ -189,7 +189,7 @@ impl Condvar { } } - /// Wake up one blocked thread on this condvar. + /// Wakes up one blocked thread on this condvar. /// /// If there is a blocked thread on this condition variable, then it will /// be woken up from its call to `wait` or `wait_timeout`. Calls to @@ -199,7 +199,7 @@ impl Condvar { #[stable(feature = "rust1", since = "1.0.0")] pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } } - /// Wake up all blocked threads on this condvar. + /// Wakes up all blocked threads on this condvar. /// /// This method will ensure that any current waiters on the condition /// variable are awoken. Calls to `notify_all()` are not buffered in any @@ -218,7 +218,7 @@ impl Drop for Condvar { } impl StaticCondvar { - /// Block the current thread until this condition variable receives a + /// Blocks the current thread until this condition variable receives a /// notification. /// /// See `Condvar::wait`. @@ -239,7 +239,7 @@ impl StaticCondvar { } } - /// Wait on this condition variable for a notification, timing out after a + /// Waits on this condition variable for a notification, timing out after a /// specified duration. /// /// See `Condvar::wait_timeout`. @@ -260,7 +260,7 @@ impl StaticCondvar { } } - /// Wait on this condition variable for a notification, timing out after a + /// Waits on this condition variable for a notification, timing out after a /// specified duration. /// /// The implementation will repeatedly wait while the duration has not @@ -306,21 +306,21 @@ impl StaticCondvar { poison::map_result(guard_result, |g| (g, true)) } - /// Wake up one blocked thread on this condvar. + /// Wakes up one blocked thread on this condvar. /// /// See `Condvar::notify_one`. #[unstable(feature = "std_misc", reason = "may be merged with Condvar in the future")] pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } } - /// Wake up all blocked threads on this condvar. + /// Wakes up all blocked threads on this condvar. /// /// See `Condvar::notify_all`. #[unstable(feature = "std_misc", reason = "may be merged with Condvar in the future")] pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } } - /// Deallocate all resources associated with this static condvar. + /// Deallocates all resources associated with this static condvar. /// /// This method is unsafe to call as there is no guarantee that there are no /// active users of the condvar, and this also doesn't prevent any future diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 93b27b6ce9e..422439fadc1 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -750,7 +750,7 @@ impl<T> Receiver<T> { } } - /// Attempt to wait for a value on this receiver, returning an error if the + /// Attempts to wait for a value on this receiver, returning an error if the /// corresponding channel has hung up. /// /// This function will always block the current thread if there is no data diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index b509b3472ee..b8ad92841f2 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -254,11 +254,11 @@ impl Select { } impl<'rx, T: Send> Handle<'rx, T> { - /// Retrieve the id of this handle. + /// Retrieves the id of this handle. #[inline] pub fn id(&self) -> usize { self.id } - /// Block to receive a value on the underlying receiver, returning `Some` on + /// Blocks to receive a value on the underlying receiver, returning `Some` on /// success or `None` if the channel disconnects. This function has the same /// semantics as `Receiver.recv` pub fn recv(&mut self) -> Result<T, RecvError> { self.rx.recv() } diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 46fb20cd6a2..7896870ea07 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -232,7 +232,7 @@ impl<T> Mutex<T> { } } - /// Determine whether the lock is poisoned. + /// Determines whether the lock is poisoned. /// /// If another thread is active, the lock can still become poisoned at any /// time. You should not trust a `false` value for program correctness diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 258cf1d38a8..948965f5efa 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -51,7 +51,7 @@ pub const ONCE_INIT: Once = Once { }; impl Once { - /// Perform an initialization routine once and only once. The given closure + /// Performs an initialization routine once and only once. The given closure /// will be executed if this is the first time `call_once` has been called, /// and otherwise the routine will *not* be invoked. /// diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index eb6d46a5dda..1ea92d5eff7 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -169,7 +169,7 @@ impl<T> RwLock<T> { RwLockReadGuard::new(&*self.inner, &self.data) } - /// Attempt to acquire this lock with shared read access. + /// Attempts to acquire this lock with shared read access. /// /// This function will never block and will return immediately if `read` /// would otherwise succeed. Returns `Some` of an RAII guard which will @@ -194,7 +194,7 @@ impl<T> RwLock<T> { } } - /// Lock this rwlock with exclusive write access, blocking the current + /// Locks this rwlock with exclusive write access, blocking the current /// thread until it can be acquired. /// /// This function will not return while other writers or other readers @@ -215,7 +215,7 @@ impl<T> RwLock<T> { RwLockWriteGuard::new(&*self.inner, &self.data) } - /// Attempt to lock this rwlock with exclusive write access. + /// Attempts to lock this rwlock with exclusive write access. /// /// This function does not ever block, and it will return `None` if a call /// to `write` would otherwise block. If successful, an RAII guard is @@ -237,7 +237,7 @@ impl<T> RwLock<T> { } } - /// Determine whether the lock is poisoned. + /// Determines whether the lock is poisoned. /// /// If another thread is active, the lock can still become poisoned at any /// time. You should not trust a `false` value for program correctness @@ -287,7 +287,7 @@ impl StaticRwLock { RwLockReadGuard::new(self, &DUMMY.0) } - /// Attempt to acquire this lock with shared read access. + /// Attempts to acquire this lock with shared read access. /// /// See `RwLock::try_read`. #[inline] @@ -302,7 +302,7 @@ impl StaticRwLock { } } - /// Lock this rwlock with exclusive write access, blocking the current + /// Locks this rwlock with exclusive write access, blocking the current /// thread until it can be acquired. /// /// See `RwLock::write`. @@ -314,7 +314,7 @@ impl StaticRwLock { RwLockWriteGuard::new(self, &DUMMY.0) } - /// Attempt to lock this rwlock with exclusive write access. + /// Attempts to lock this rwlock with exclusive write access. /// /// See `RwLock::try_write`. #[inline] @@ -329,7 +329,7 @@ impl StaticRwLock { } } - /// Deallocate all resources associated with this static lock. + /// Deallocates all resources associated with this static lock. /// /// This method is unsafe to call as there is no guarantee that there are no /// active users of the lock, and this also doesn't prevent any future users diff --git a/src/libstd/sys/common/condvar.rs b/src/libstd/sys/common/condvar.rs index 32fa6ec5903..9f46b0c3824 100644 --- a/src/libstd/sys/common/condvar.rs +++ b/src/libstd/sys/common/condvar.rs @@ -31,15 +31,15 @@ impl Condvar { #[inline] pub unsafe fn new() -> Condvar { Condvar(imp::Condvar::new()) } - /// Signal one waiter on this condition variable to wake up. + /// Signals one waiter on this condition variable to wake up. #[inline] pub unsafe fn notify_one(&self) { self.0.notify_one() } - /// Awaken all current waiters on this condition variable. + /// Awakens all current waiters on this condition variable. #[inline] pub unsafe fn notify_all(&self) { self.0.notify_all() } - /// Wait for a signal on the specified mutex. + /// Waits for a signal on the specified mutex. /// /// Behavior is undefined if the mutex is not locked by the current thread. /// Behavior is also undefined if more than one mutex is used concurrently @@ -47,7 +47,7 @@ impl Condvar { #[inline] pub unsafe fn wait(&self, mutex: &Mutex) { self.0.wait(mutex::raw(mutex)) } - /// Wait for a signal on the specified mutex with a timeout duration + /// Waits for a signal on the specified mutex with a timeout duration /// specified by `dur` (a relative time into the future). /// /// Behavior is undefined if the mutex is not locked by the current thread. @@ -58,7 +58,7 @@ impl Condvar { self.0.wait_timeout(mutex::raw(mutex), dur) } - /// Deallocate all resources associated with this condition variable. + /// Deallocates all resources associated with this condition variable. /// /// Behavior is undefined if there are current or will be future users of /// this condition variable. diff --git a/src/libstd/sys/common/mutex.rs b/src/libstd/sys/common/mutex.rs index 0ca22826700..1f9dd54192c 100644 --- a/src/libstd/sys/common/mutex.rs +++ b/src/libstd/sys/common/mutex.rs @@ -24,14 +24,14 @@ unsafe impl Sync for Mutex {} pub const MUTEX_INIT: Mutex = Mutex(imp::MUTEX_INIT); impl Mutex { - /// Lock the mutex blocking the current thread until it is available. + /// Locks the mutex blocking the current thread until it is available. /// /// Behavior is undefined if the mutex has been moved between this and any /// previous function call. #[inline] pub unsafe fn lock(&self) { self.0.lock() } - /// Attempt to lock the mutex without blocking, returning whether it was + /// Attempts to lock the mutex without blocking, returning whether it was /// successfully acquired or not. /// /// Behavior is undefined if the mutex has been moved between this and any @@ -39,14 +39,14 @@ impl Mutex { #[inline] pub unsafe fn try_lock(&self) -> bool { self.0.try_lock() } - /// Unlock the mutex. + /// Unlocks the mutex. /// /// Behavior is undefined if the current thread does not actually hold the /// mutex. #[inline] pub unsafe fn unlock(&self) { self.0.unlock() } - /// Deallocate all resources associated with this mutex. + /// Deallocates all resources associated with this mutex. /// /// Behavior is undefined if there are current or will be future users of /// this mutex. diff --git a/src/libstd/sys/common/poison.rs b/src/libstd/sys/common/poison.rs index 347cd0b464e..6deb4a48007 100644 --- a/src/libstd/sys/common/poison.rs +++ b/src/libstd/sys/common/poison.rs @@ -116,7 +116,7 @@ impl<T: Send> Error for PoisonError<T> { } impl<T> PoisonError<T> { - /// Create a `PoisonError`. + /// Creates a `PoisonError`. #[unstable(feature = "std_misc")] pub fn new(guard: T) -> PoisonError<T> { PoisonError { guard: guard } diff --git a/src/libstd/sys/common/rwlock.rs b/src/libstd/sys/common/rwlock.rs index f7d7a5715bc..725a09bcc86 100644 --- a/src/libstd/sys/common/rwlock.rs +++ b/src/libstd/sys/common/rwlock.rs @@ -21,7 +21,7 @@ pub struct RWLock(imp::RWLock); pub const RWLOCK_INIT: RWLock = RWLock(imp::RWLOCK_INIT); impl RWLock { - /// Acquire shared access to the underlying lock, blocking the current + /// Acquires shared access to the underlying lock, blocking the current /// thread to do so. /// /// Behavior is undefined if the rwlock has been moved between this and any @@ -29,7 +29,7 @@ impl RWLock { #[inline] pub unsafe fn read(&self) { self.0.read() } - /// Attempt to acquire shared access to this lock, returning whether it + /// Attempts to acquire shared access to this lock, returning whether it /// succeeded or not. /// /// This function does not block the current thread. @@ -39,7 +39,7 @@ impl RWLock { #[inline] pub unsafe fn try_read(&self) -> bool { self.0.try_read() } - /// Acquire write access to the underlying lock, blocking the current thread + /// Acquires write access to the underlying lock, blocking the current thread /// to do so. /// /// Behavior is undefined if the rwlock has been moved between this and any @@ -47,7 +47,7 @@ impl RWLock { #[inline] pub unsafe fn write(&self) { self.0.write() } - /// Attempt to acquire exclusive access to this lock, returning whether it + /// Attempts to acquire exclusive access to this lock, returning whether it /// succeeded or not. /// /// This function does not block the current thread. @@ -57,20 +57,20 @@ impl RWLock { #[inline] pub unsafe fn try_write(&self) -> bool { self.0.try_write() } - /// Unlock previously acquired shared access to this lock. + /// Unlocks previously acquired shared access to this lock. /// /// Behavior is undefined if the current thread does not have shared access. #[inline] pub unsafe fn read_unlock(&self) { self.0.read_unlock() } - /// Unlock previously acquired exclusive access to this lock. + /// Unlocks previously acquired exclusive access to this lock. /// /// Behavior is undefined if the current thread does not currently have /// exclusive access. #[inline] pub unsafe fn write_unlock(&self) { self.0.write_unlock() } - /// Destroy OS-related resources with this RWLock. + /// Destroys OS-related resources with this RWLock. /// /// Behavior is undefined if there are any currently active users of this /// lock. diff --git a/src/libstd/sys/common/thread_local.rs b/src/libstd/sys/common/thread_local.rs index 5995d7ac10f..618a389110a 100644 --- a/src/libstd/sys/common/thread_local.rs +++ b/src/libstd/sys/common/thread_local.rs @@ -207,7 +207,7 @@ impl StaticKey { } impl Key { - /// Create a new managed OS TLS key. + /// Creates a new managed OS TLS key. /// /// This key will be deallocated when the key falls out of scope. /// diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 987a12293da..34a4a773f8e 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -69,7 +69,7 @@ impl fmt::Debug for CodePoint { } impl CodePoint { - /// Unsafely create a new `CodePoint` without checking the value. + /// Unsafely creates a new `CodePoint` without checking the value. /// /// Only use when `value` is known to be less than or equal to 0x10FFFF. #[inline] @@ -77,9 +77,9 @@ impl CodePoint { CodePoint { value: value } } - /// Create a new `CodePoint` if the value is a valid code point. + /// Creates a new `CodePoint` if the value is a valid code point. /// - /// Return `None` if `value` is above 0x10FFFF. + /// Returns `None` if `value` is above 0x10FFFF. #[inline] pub fn from_u32(value: u32) -> Option<CodePoint> { match value { @@ -88,7 +88,7 @@ impl CodePoint { } } - /// Create a new `CodePoint` from a `char`. + /// Creates a new `CodePoint` from a `char`. /// /// Since all Unicode scalar values are code points, this always succeeds. #[inline] @@ -96,15 +96,15 @@ impl CodePoint { CodePoint { value: value as u32 } } - /// Return the numeric value of the code point. + /// Returns the numeric value of the code point. #[inline] pub fn to_u32(&self) -> u32 { self.value } - /// Optionally return a Unicode scalar value for the code point. + /// Optionally returns a Unicode scalar value for the code point. /// - /// Return `None` if the code point is a surrogate (from U+D800 to U+DFFF). + /// Returns `None` if the code point is a surrogate (from U+D800 to U+DFFF). #[inline] pub fn to_char(&self) -> Option<char> { match self.value { @@ -113,9 +113,9 @@ impl CodePoint { } } - /// Return a Unicode scalar value for the code point. + /// Returns a Unicode scalar value for the code point. /// - /// Return `'\u{FFFD}'` (the replacement character “�”) + /// Returns `'\u{FFFD}'` (the replacement character “�”) /// if the code point is a surrogate (from U+D800 to U+DFFF). #[inline] pub fn to_char_lossy(&self) -> char { @@ -151,19 +151,19 @@ impl fmt::Debug for Wtf8Buf { } impl Wtf8Buf { - /// Create an new, empty WTF-8 string. + /// Creates an new, empty WTF-8 string. #[inline] pub fn new() -> Wtf8Buf { Wtf8Buf { bytes: Vec::new() } } - /// Create an new, empty WTF-8 string with pre-allocated capacity for `n` bytes. + /// Creates an new, empty WTF-8 string with pre-allocated capacity for `n` bytes. #[inline] pub fn with_capacity(n: usize) -> Wtf8Buf { Wtf8Buf { bytes: Vec::with_capacity(n) } } - /// Create a WTF-8 string from an UTF-8 `String`. + /// Creates a WTF-8 string from an UTF-8 `String`. /// /// This takes ownership of the `String` and does not copy. /// @@ -173,7 +173,7 @@ impl Wtf8Buf { Wtf8Buf { bytes: string.into_bytes() } } - /// Create a WTF-8 string from an UTF-8 `&str` slice. + /// Creates a WTF-8 string from an UTF-8 `&str` slice. /// /// This copies the content of the slice. /// @@ -183,7 +183,7 @@ impl Wtf8Buf { Wtf8Buf { bytes: <[_]>::to_vec(str.as_bytes()) } } - /// Create a WTF-8 string from a potentially ill-formed UTF-16 slice of 16-bit code units. + /// Creates a WTF-8 string from a potentially ill-formed UTF-16 slice of 16-bit code units. /// /// This is lossless: calling `.encode_wide()` on the resulting string /// will always return the original code units. @@ -319,7 +319,7 @@ impl Wtf8Buf { self.bytes.truncate(new_len) } - /// Consume the WTF-8 string and try to convert it to UTF-8. + /// Consumes the WTF-8 string and tries to convert it to UTF-8. /// /// This does not copy the data. /// @@ -333,7 +333,7 @@ impl Wtf8Buf { } } - /// Consume the WTF-8 string and convert it lossily to UTF-8. + /// Consumes the WTF-8 string and converts it lossily to UTF-8. /// /// This does not copy the data (but may overwrite parts of it in place). /// @@ -454,7 +454,7 @@ impl fmt::Debug for Wtf8 { } impl Wtf8 { - /// Create a WTF-8 slice from a UTF-8 `&str` slice. + /// Creates a WTF-8 slice from a UTF-8 `&str` slice. /// /// Since WTF-8 is a superset of UTF-8, this always succeeds. #[inline] @@ -462,13 +462,13 @@ impl Wtf8 { unsafe { mem::transmute(value.as_bytes()) } } - /// Return the length, in WTF-8 bytes. + /// Returns the length, in WTF-8 bytes. #[inline] pub fn len(&self) -> usize { self.bytes.len() } - /// Return the code point at `position` if it is in the ASCII range, + /// Returns the code point at `position` if it is in the ASCII range, /// or `b'\xFF' otherwise. /// /// # Panics @@ -482,7 +482,7 @@ impl Wtf8 { } } - /// Return the code point at `position`. + /// Returns the code point at `position`. /// /// # Panics /// @@ -494,7 +494,7 @@ impl Wtf8 { code_point } - /// Return the code point at `position` + /// Returns the code point at `position` /// and the position of the next code point. /// /// # Panics @@ -507,15 +507,15 @@ impl Wtf8 { (CodePoint { value: c }, n) } - /// Return an iterator for the string’s code points. + /// Returns an iterator for the string’s code points. #[inline] pub fn code_points(&self) -> Wtf8CodePoints { Wtf8CodePoints { bytes: self.bytes.iter() } } - /// Try to convert the string to UTF-8 and return a `&str` slice. + /// Tries to convert the string to UTF-8 and return a `&str` slice. /// - /// Return `None` if the string contains surrogates. + /// Returns `None` if the string contains surrogates. /// /// This does not copy the data. #[inline] @@ -528,8 +528,8 @@ impl Wtf8 { } } - /// Lossily convert the string to UTF-8. - /// Return an UTF-8 `&str` slice if the contents are well-formed in UTF-8. + /// Lossily converts the string to UTF-8. + /// Returns an UTF-8 `&str` slice if the contents are well-formed in UTF-8. /// /// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “�”). /// @@ -559,7 +559,7 @@ impl Wtf8 { } } - /// Convert the WTF-8 string to potentially ill-formed UTF-16 + /// Converts the WTF-8 string to potentially ill-formed UTF-16 /// and return an iterator of 16-bit code units. /// /// This is lossless: diff --git a/src/libstd/sys/unix/ext.rs b/src/libstd/sys/unix/ext.rs index fbfbb40701f..a95cb85e74a 100644 --- a/src/libstd/sys/unix/ext.rs +++ b/src/libstd/sys/unix/ext.rs @@ -53,7 +53,7 @@ pub mod io { /// and `AsRawSocket` set of traits. #[stable(feature = "rust1", since = "1.0.0")] pub trait AsRawFd { - /// Extract the raw file descriptor. + /// Extracts the raw file descriptor. /// /// This method does **not** pass ownership of the raw file descriptor /// to the caller. The descriptor is only guarantee to be valid while @@ -216,11 +216,11 @@ pub mod ffi { /// Unix-specific extensions to `OsString`. #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStringExt { - /// Create an `OsString` from a byte vector. + /// Creates an `OsString` from a byte vector. #[stable(feature = "rust1", since = "1.0.0")] fn from_vec(vec: Vec<u8>) -> Self; - /// Yield the underlying byte vector of this `OsString`. + /// Yields the underlying byte vector of this `OsString`. #[stable(feature = "rust1", since = "1.0.0")] fn into_vec(self) -> Vec<u8>; } @@ -241,7 +241,7 @@ pub mod ffi { #[stable(feature = "rust1", since = "1.0.0")] fn from_bytes(slice: &[u8]) -> &Self; - /// Get the underlying byte view of the `OsStr` slice. + /// Gets the underlying byte view of the `OsStr` slice. #[stable(feature = "rust1", since = "1.0.0")] fn as_bytes(&self) -> &[u8]; } @@ -280,7 +280,7 @@ pub mod fs { /// Unix-specific extensions to `OpenOptions` pub trait OpenOptionsExt { - /// Set the mode bits that a new file will be created with. + /// Sets the mode bits that a new file will be created with. /// /// If a new file is created as part of a `File::open_opts` call then this /// specified `mode` will be used as the permission bits for the new file. diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index d86c77624e8..e5bdb554359 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -28,7 +28,7 @@ impl FileDesc { pub fn raw(&self) -> c_int { self.fd } - /// Extract the actual filedescriptor without closing it. + /// Extracts the actual filedescriptor without closing it. pub fn into_raw(self) -> c_int { let fd = self.fd; unsafe { mem::forget(self) }; diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 6121105f10b..c74d6b7e077 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -130,7 +130,7 @@ impl FileDesc { } } - /// Extract the actual filedescriptor without closing it. + /// Extracts the actual filedescriptor without closing it. pub fn unwrap(self) -> fd_t { let fd = self.fd; unsafe { mem::forget(self) }; diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index e8409bb4fd4..71da2f9219c 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -85,7 +85,7 @@ pub fn last_gai_error(s: libc::c_int) -> IoError { err } -/// Convert an `errno` value into a high-level error variant and description. +/// Converts an `errno` value into a high-level error variant and description. #[allow(deprecated)] pub fn decode_error(errno: i32) -> IoError { // FIXME: this should probably be a bit more descriptive... diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index d2220bdec32..52ec6063d7a 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -86,7 +86,7 @@ pub fn errno() -> i32 { } } -/// Get a detailed string description for the given error number +/// Gets a detailed string description for the given error number. pub fn error_string(errno: i32) -> String { #[cfg(target_os = "linux")] extern { diff --git a/src/libstd/sys/windows/ext.rs b/src/libstd/sys/windows/ext.rs index 2dd61861bd6..022407ebc02 100644 --- a/src/libstd/sys/windows/ext.rs +++ b/src/libstd/sys/windows/ext.rs @@ -38,7 +38,7 @@ pub mod io { /// Extract raw handles. #[stable(feature = "rust1", since = "1.0.0")] pub trait AsRawHandle { - /// Extract the raw handle, without taking any ownership. + /// Extracts the raw handle, without taking any ownership. #[stable(feature = "rust1", since = "1.0.0")] fn as_raw_handle(&self) -> RawHandle; } @@ -47,7 +47,7 @@ pub mod io { #[unstable(feature = "from_raw_os", reason = "recent addition to the std::os::windows::io module")] pub trait FromRawHandle { - /// Construct a new I/O object from the specified raw handle. + /// Constructs a new I/O object from the specified raw handle. /// /// This function will **consume ownership** of the handle given, /// passing responsibility for closing the handle to the returned @@ -112,7 +112,7 @@ pub mod io { /// Extract raw sockets. #[stable(feature = "rust1", since = "1.0.0")] pub trait AsRawSocket { - /// Extract the underlying raw socket from this object. + /// Extracts the underlying raw socket from this object. #[stable(feature = "rust1", since = "1.0.0")] fn as_raw_socket(&self) -> RawSocket; } @@ -214,7 +214,7 @@ pub mod ffi { /// Windows-specific extensions to `OsString`. #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStringExt { - /// Create an `OsString` from a potentially ill-formed UTF-16 slice of + /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of /// 16-bit code units. /// /// This is lossless: calling `.encode_wide()` on the resulting string @@ -233,7 +233,7 @@ pub mod ffi { /// Windows-specific extensions to `OsStr`. #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStrExt { - /// Re-encode an `OsStr` as a wide character sequence, + /// Re-encodes an `OsStr` as a wide character sequence, /// i.e. potentially ill-formed UTF-16. /// /// This is lossless. Note that the encoding does not include a final @@ -258,25 +258,25 @@ pub mod fs { /// Windows-specific extensions to `OpenOptions` pub trait OpenOptionsExt { - /// Override the `dwDesiredAccess` argument to the call to `CreateFile` + /// Overrides the `dwDesiredAccess` argument to the call to `CreateFile` /// with the specified value. fn desired_access(&mut self, access: i32) -> &mut Self; - /// Override the `dwCreationDisposition` argument to the call to + /// Overrides the `dwCreationDisposition` argument to the call to /// `CreateFile` with the specified value. /// /// This will override any values of the standard `create` flags, for /// example. fn creation_disposition(&mut self, val: i32) -> &mut Self; - /// Override the `dwFlagsAndAttributes` argument to the call to + /// Overrides the `dwFlagsAndAttributes` argument to the call to /// `CreateFile` with the specified value. /// /// This will override any values of the standard flags on the /// `OpenOptions` structure. fn flags_and_attributes(&mut self, val: i32) -> &mut Self; - /// Override the `dwShareMode` argument to the call to `CreateFile` with + /// Overrides the `dwShareMode` argument to the call to `CreateFile` with /// the specified value. /// /// This will override any values of the standard flags on the diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index e9d5fca531f..eb031e9b745 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -95,7 +95,7 @@ pub fn last_gai_error(_errno: i32) -> IoError { last_net_error() } -/// Convert an `errno` value into a high-level error variant and description. +/// Converts an `errno` value into a high-level error variant and description. #[allow(deprecated)] pub fn decode_error(errno: i32) -> IoError { let (kind, desc) = match errno { diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index d5843a2f998..232e5669c2b 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -42,7 +42,7 @@ pub fn errno() -> i32 { unsafe { libc::GetLastError() as i32 } } -/// Get a detailed string description for the given error number +/// Gets a detailed string description for the given error number. pub fn error_string(errnum: i32) -> String { use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index f5a1093be2b..cc4031cc180 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -226,7 +226,7 @@ pub enum LocalKeyState { } impl<T: 'static> LocalKey<T> { - /// Acquire a reference to the value in this TLS key. + /// Acquires a reference to the value in this TLS key. /// /// This will lazily initialize the value if this thread has not referenced /// this key yet. diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 0e5fee27ffe..5db7e9773c9 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -215,7 +215,7 @@ pub struct Builder { } impl Builder { - /// Generate the base configuration for spawning a thread, from which + /// Generates the base configuration for spawning a thread, from which /// configuration methods can be chained. #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> Builder { @@ -225,7 +225,7 @@ impl Builder { } } - /// Name the thread-to-be. Currently the name is used for identification + /// Names the thread-to-be. Currently the name is used for identification /// only in panic messages. #[stable(feature = "rust1", since = "1.0.0")] pub fn name(mut self, name: String) -> Builder { @@ -233,14 +233,14 @@ impl Builder { self } - /// Set the size of the stack for the new thread. + /// Sets the size of the stack for the new thread. #[stable(feature = "rust1", since = "1.0.0")] pub fn stack_size(mut self, size: usize) -> Builder { self.stack_size = Some(size); self } - /// Spawn a new thread, and return a join handle for it. + /// Spawns a new thread, and returns a join handle for it. /// /// The child thread may outlive the parent (unless the parent thread /// is the main thread; the whole process is terminated when the main @@ -259,8 +259,8 @@ impl Builder { self.spawn_inner(Box::new(f)).map(|i| JoinHandle(i)) } - /// Spawn a new child thread that must be joined within a given - /// scope, and return a `JoinGuard`. + /// Spawns a new child thread that must be joined within a given + /// scope, and returns a `JoinGuard`. /// /// The join guard can be used to explicitly join the child thread (via /// `join`), returning `Result<T>`, or it will implicitly join the child @@ -355,7 +355,7 @@ impl Builder { // Free functions //////////////////////////////////////////////////////////////////////////////// -/// Spawn a new thread, returning a `JoinHandle` for it. +/// Spawns a new thread, returning a `JoinHandle` for it. /// /// The join handle will implicitly *detach* the child thread upon being /// dropped. In this case, the child thread may outlive the parent (unless @@ -374,7 +374,7 @@ pub fn spawn<F>(f: F) -> JoinHandle where F: FnOnce(), F: Send + 'static { Builder::new().spawn(f).unwrap() } -/// Spawn a new *scoped* thread, returning a `JoinGuard` for it. +/// Spawns a new *scoped* thread, returning a `JoinGuard` for it. /// /// The join guard can be used to explicitly join the child thread (via /// `join`), returning `Result<T>`, or it will implicitly join the child @@ -400,7 +400,7 @@ pub fn current() -> Thread { thread_info::current_thread() } -/// Cooperatively give up a timeslice to the OS scheduler. +/// Cooperatively gives up a timeslice to the OS scheduler. #[stable(feature = "rust1", since = "1.0.0")] pub fn yield_now() { unsafe { imp::yield_now() } @@ -413,7 +413,7 @@ pub fn panicking() -> bool { unwind::panicking() } -/// Invoke a closure, capturing the cause of panic if one occurs. +/// Invokes a closure, capturing the cause of panic if one occurs. /// /// This function will return `Ok(())` if the closure does not panic, and will /// return `Err(cause)` if the closure panics. The `cause` returned is the @@ -462,7 +462,7 @@ pub fn catch_panic<F, R>(f: F) -> Result<R> Ok(result.unwrap()) } -/// Put the current thread to sleep for the specified amount of time. +/// Puts the current thread to sleep for the specified amount of time. /// /// The thread may sleep longer than the duration specified due to scheduling /// specifics or platform-dependent functionality. Note that on unix platforms @@ -482,7 +482,7 @@ pub fn sleep(dur: Duration) { imp::sleep(dur) } -/// Block unless or until the current thread's token is made available (may wake spuriously). +/// Blocks unless or until the current thread's token is made available (may wake spuriously). /// /// See the module doc for more detail. // @@ -501,7 +501,7 @@ pub fn park() { *guard = false; } -/// Block unless or until the current thread's token is made available or +/// Blocks unless or until the current thread's token is made available or /// the specified duration has been reached (may wake spuriously). /// /// The semantics of this function are equivalent to `park()` except that the @@ -573,7 +573,7 @@ impl Thread { } } - /// Get the thread's name. + /// Gets the thread's name. #[stable(feature = "rust1", since = "1.0.0")] pub fn name(&self) -> Option<&str> { self.inner.name.as_ref().map(|s| &**s) @@ -638,13 +638,13 @@ impl<T> JoinInner<T> { pub struct JoinHandle(JoinInner<()>); impl JoinHandle { - /// Extract a handle to the underlying thread + /// Extracts a handle to the underlying thread #[stable(feature = "rust1", since = "1.0.0")] pub fn thread(&self) -> &Thread { &self.0.thread } - /// Wait for the associated thread to finish. + /// Waits for the associated thread to finish. /// /// If the child thread panics, `Err` is returned with the parameter given /// to `panic`. @@ -684,13 +684,13 @@ pub struct JoinGuard<'a, T: Send + 'a> { unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {} impl<'a, T: Send + 'a> JoinGuard<'a, T> { - /// Extract a handle to the thread this guard will join on. + /// Extracts a handle to the thread this guard will join on. #[stable(feature = "rust1", since = "1.0.0")] pub fn thread(&self) -> &Thread { &self.inner.thread } - /// Wait for the associated thread to finish, returning the result of the + /// Waits for the associated thread to finish, returning the result of the /// thread's calculation. /// /// # Panics diff --git a/src/libstd/thread/scoped_tls.rs b/src/libstd/thread/scoped_tls.rs index fa980954c2f..9c0b4a5d833 100644 --- a/src/libstd/thread/scoped_tls.rs +++ b/src/libstd/thread/scoped_tls.rs @@ -135,7 +135,7 @@ macro_rules! __scoped_thread_local_inner { reason = "scoped TLS has yet to have wide enough use to fully consider \ stabilizing its interface")] impl<T> ScopedKey<T> { - /// Insert a value into this scoped thread local storage slot for a + /// Inserts a value into this scoped thread local storage slot for a /// duration of a closure. /// /// While `cb` is running, the value `t` will be returned by `get` unless @@ -188,7 +188,7 @@ impl<T> ScopedKey<T> { cb() } - /// Get a value out of this scoped variable. + /// Gets a value out of this scoped variable. /// /// This function takes a closure which receives the value of this /// variable. |
