X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibcore%2Foption.rs;h=4bec3ec9f6b423aa1239653cadcc482a1ae58cb0;hb=d36d3fa5a6441f13c3888b6895cc7046740b1e3d;hp=5db92a1b35248e65030d1b767af7e92f8fbaf559;hpb=a5206f9749faf60f6b4163a526de9ad18241503e;p=rust.git diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 5db92a1b352..4bec3ec9f6b 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -916,8 +916,8 @@ pub fn replace(&mut self, value: T) -> Option { /// Zips `self` with another `Option`. /// - /// Returns `Some((_, _))` when both `self` and `other` - /// are `Some(_)`, otherwise return `None`. + /// If `self` is `Some(s)` and other is `Some(o)`, this method returns `Some((s, o))`. + /// Otherwise, `None` is returned. /// /// # Examples /// @@ -930,16 +930,15 @@ pub fn replace(&mut self, value: T) -> Option { /// assert_eq!(x.zip(y), Some((1, "hi"))); /// assert_eq!(x.zip(z), None); /// ``` - #[inline] - #[unstable(feature = "option_zip", issue = "none")] + #[unstable(feature = "option_zip", issue = "70086")] pub fn zip(self, other: Option) -> Option<(T, U)> { self.zip_with(other, |a, b| (a, b)) } /// Zips `self` and another `Option` with function `f`. /// - /// Returns `Some(_)` when both `self` and `other` - /// are `Some(_)`, otherwise return `None`. + /// If `self` is `Some(s)` and other is `Some(o)`, this method returns `Some(f(s, o))`. + /// Otherwise, `None` is returned. /// /// # Examples /// @@ -958,14 +957,13 @@ pub fn zip(self, other: Option) -> Option<(T, U)> { /// } /// } /// - /// let x = Some(17.); - /// let y = Some(42.); + /// let x = Some(17.5); + /// let y = Some(42.7); /// - /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17., y: 42. })); + /// assert_eq!(x.zip_with(y, Point::new), Some(Point { x: 17.5, y: 42.7 })); /// assert_eq!(x.zip_with(None, Point::new), None); /// ``` - #[inline] - #[unstable(feature = "option_zip", issue = "none")] + #[unstable(feature = "option_zip", issue = "70086")] pub fn zip_with(self, other: Option, f: F) -> Option where F: FnOnce(T, U) -> R,