Auto merge of #39933 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #39847, #39862, #39898, #39904, #39928 - Failed merges:
This commit is contained in:
commit
306035c217
|
@ -169,7 +169,7 @@ So this is where quotes comes in. The `ast` argument is a struct that gives us
|
|||
a representation of our type (which can be either a `struct` or an `enum`).
|
||||
Check out the [docs](https://docs.rs/syn/0.10.5/syn/struct.MacroInput.html),
|
||||
there is some useful information there. We are able to get the name of the
|
||||
type using `ast.ident`. The `quote!` macro let's us write up the Rust code
|
||||
type using `ast.ident`. The `quote!` macro lets us write up the Rust code
|
||||
that we wish to return and convert it into `Tokens`. `quote!` let's us use some
|
||||
really cool templating mechanics; we simply write `#name` and `quote!` will
|
||||
replace it with the variable named `name`. You can even do some repetition
|
||||
|
|
|
@ -1250,17 +1250,17 @@ impl String {
|
|||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Divide one string into two at an index.
|
||||
/// Splits the string into two at the given index.
|
||||
///
|
||||
/// The argument, `mid`, should be a byte offset from the start of the string. It must also
|
||||
/// be on the boundary of a UTF-8 code point.
|
||||
/// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
|
||||
/// the returned `String` contains bytes `[at, len)`. `at` must be on the
|
||||
/// boundary of a UTF-8 code point.
|
||||
///
|
||||
/// The two strings returned go from the start of the string to `mid`, and from `mid` to the end
|
||||
/// of the string.
|
||||
/// Note that the capacity of `self` does not change.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `mid` is not on a `UTF-8` code point boundary, or if it is beyond the last
|
||||
/// Panics if `at` is not on a `UTF-8` code point boundary, or if it is beyond the last
|
||||
/// code point of the string.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -1275,9 +1275,9 @@ impl String {
|
|||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "string_split_off", since = "1.16.0")]
|
||||
pub fn split_off(&mut self, mid: usize) -> String {
|
||||
assert!(self.is_char_boundary(mid));
|
||||
let other = self.vec.split_off(mid);
|
||||
pub fn split_off(&mut self, at: usize) -> String {
|
||||
assert!(self.is_char_boundary(at));
|
||||
let other = self.vec.split_off(at);
|
||||
unsafe { String::from_utf8_unchecked(other) }
|
||||
}
|
||||
|
||||
|
|
|
@ -1603,12 +1603,12 @@ pub trait Iterator {
|
|||
let mut i = self.len();
|
||||
|
||||
while let Some(v) = self.next_back() {
|
||||
if predicate(v) {
|
||||
return Some(i - 1);
|
||||
}
|
||||
// No need for an overflow check here, because `ExactSizeIterator`
|
||||
// implies that the number of elements fits into a `usize`.
|
||||
i -= 1;
|
||||
if predicate(v) {
|
||||
return Some(i);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
|
@ -96,7 +96,9 @@ pub struct VarsOs { inner: os_imp::Env }
|
|||
///
|
||||
/// 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`] function.
|
||||
///
|
||||
/// [`env::vars_os`]: fn.vars_os.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -171,9 +173,12 @@ impl fmt::Debug for VarsOs {
|
|||
|
||||
/// Fetches the environment variable `key` from the current process.
|
||||
///
|
||||
/// The returned result is `Ok(s)` if the environment variable is present and is
|
||||
/// The returned result is [`Ok(s)`] if the environment variable is present and is
|
||||
/// valid unicode. If the environment variable is not present, or it is not
|
||||
/// valid unicode, then `Err` will be returned.
|
||||
/// valid unicode, then [`Err`] will be returned.
|
||||
///
|
||||
/// [`Ok(s)`]: ../result/enum.Result.html#variant.Ok
|
||||
/// [`Err`]: ../result/enum.Result.html#variant.Err
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -199,7 +204,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
|
|||
}
|
||||
|
||||
/// Fetches the environment variable `key` from the current process, returning
|
||||
/// `None` if the variable isn't set.
|
||||
/// [`None`] if the variable isn't set.
|
||||
///
|
||||
/// [`None`]: ../option/enum.Option.html#variant.None
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
@ -316,7 +316,7 @@ impl Once {
|
|||
}
|
||||
|
||||
// Once we've enqueued ourselves, wait in a loop.
|
||||
// Aftewards reload the state and continue with what we
|
||||
// Afterwards reload the state and continue with what we
|
||||
// were doing from before.
|
||||
while !node.signaled.load(Ordering::SeqCst) {
|
||||
thread::park();
|
||||
|
|
|
@ -28,8 +28,8 @@ use mem;
|
|||
/// # Initialization and Destruction
|
||||
///
|
||||
/// Initialization is dynamically performed on the first call to `with()`
|
||||
/// within a thread, and values support destructors which will be run when a
|
||||
/// thread exits.
|
||||
/// within a thread, and values that implement `Drop` get destructed when a
|
||||
/// thread exits. Some caveats apply, which are explained below.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue