diff options
| author | Stefan Lankes <stlankes@users.noreply.github.com> | 2019-10-22 19:01:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-22 19:01:09 +0200 |
| commit | ddcd157d03a067419d7f5b4375cfaff5a474856a (patch) | |
| tree | c0b1bc8b196ff630dc9b7dfcf6f4e869e38b5e6c /src/libcore | |
| parent | 8a11c61a7af9ffa6585ee93b266e02fa1d642ba8 (diff) | |
| parent | 57bfb8096295150c06559da10adc5629e445a4ac (diff) | |
Merge branch 'master' into rusty-hermit
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/iter/traits/collect.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/ops/unsize.rs | 2 | ||||
| -rw-r--r-- | src/libcore/option.rs | 8 | ||||
| -rw-r--r-- | src/libcore/ptr/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 4 |
6 files changed, 12 insertions, 12 deletions
diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs index 25439136b85..00a86417058 100644 --- a/src/libcore/iter/traits/collect.rs +++ b/src/libcore/iter/traits/collect.rs @@ -167,7 +167,7 @@ pub trait FromIterator<A>: Sized { /// // and we'll implement IntoIterator /// impl IntoIterator for MyCollection { /// type Item = i32; -/// type IntoIter = ::std::vec::IntoIter<Self::Item>; +/// type IntoIter = std::vec::IntoIter<Self::Item>; /// /// fn into_iter(self) -> Self::IntoIter { /// self.0.into_iter() diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 8f4ade377e3..b4ade704144 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -3757,8 +3757,8 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] #[inline] - pub fn is_power_of_two(self) -> bool { - (self.wrapping_sub(1)) & self == 0 && !(self == 0) + pub const fn is_power_of_two(self) -> bool { + self.count_ones() == 1 } } diff --git a/src/libcore/ops/unsize.rs b/src/libcore/ops/unsize.rs index 8e468300846..d29147645f7 100644 --- a/src/libcore/ops/unsize.rs +++ b/src/libcore/ops/unsize.rs @@ -76,7 +76,7 @@ impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {} /// ``` /// # #![feature(dispatch_from_dyn, unsize)] /// # use std::{ops::DispatchFromDyn, marker::Unsize}; -/// # struct Rc<T: ?Sized>(::std::rc::Rc<T>); +/// # struct Rc<T: ?Sized>(std::rc::Rc<T>); /// impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Rc<U>> for Rc<T> /// where /// T: Unsize<U>, diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 47e3a0d2167..9eb29eae7f7 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -64,7 +64,7 @@ //! //! fn check_optional(optional: Option<Box<i32>>) { //! match optional { -//! Some(ref p) => println!("has value {}", p), +//! Some(p) => println!("has value {}", p), //! None => println!("has no value"), //! } //! } @@ -83,7 +83,7 @@ //! let msg = Some("howdy"); //! //! // Take a reference to the contained string -//! if let Some(ref m) = msg { +//! if let Some(m) = &msg { //! println!("{}", *m); //! } //! @@ -395,10 +395,10 @@ impl<T> Option<T> { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn unwrap_or(self, def: T) -> T { + pub fn unwrap_or(self, default: T) -> T { match self { Some(x) => x, - None => def, + None => default, } } diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index 93391918595..3cc0a1cd75e 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -188,7 +188,7 @@ unsafe fn real_drop_in_place<T: ?Sized>(to_drop: &mut T) { /// let p: *const i32 = ptr::null(); /// assert!(p.is_null()); /// ``` -#[inline] +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_promotable] pub const fn null<T>() -> *const T { 0 as *const T } @@ -203,7 +203,7 @@ pub const fn null<T>() -> *const T { 0 as *const T } /// let p: *mut i32 = ptr::null_mut(); /// assert!(p.is_null()); /// ``` -#[inline] +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_promotable] pub const fn null_mut<T>() -> *mut T { 0 as *mut T } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 885696e5acf..f67012d8f2f 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -176,7 +176,7 @@ Section: Creating a string /// ``` /// fn from_utf8_lossy<F>(mut input: &[u8], mut push: F) where F: FnMut(&str) { /// loop { -/// match ::std::str::from_utf8(input) { +/// match std::str::from_utf8(input) { /// Ok(valid) => { /// push(valid); /// break @@ -184,7 +184,7 @@ Section: Creating a string /// Err(error) => { /// let (valid, after_valid) = input.split_at(error.valid_up_to()); /// unsafe { -/// push(::std::str::from_utf8_unchecked(valid)) +/// push(std::str::from_utf8_unchecked(valid)) /// } /// push("\u{FFFD}"); /// |
