]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/str/mod.rs
Auto merge of #79780 - camelid:use-summary_opts, r=GuillaumeGomez
[rust.git] / library / core / src / str / mod.rs
index 23d63a4787efa595cb76a0218747c93089956fd5..83cf47c8c8f61edbde4661068275e210d55a50ae 100644 (file)
@@ -219,8 +219,7 @@ pub fn is_char_boundary(&self, index: usize) -> bool {
     #[rustc_const_stable(feature = "str_as_bytes", since = "1.32.0")]
     #[inline(always)]
     #[allow(unused_attributes)]
-    #[cfg_attr(not(bootstrap), rustc_allow_const_fn_unstable(const_fn_transmute))]
-    #[cfg_attr(bootstrap, allow_internal_unstable(const_fn_transmute))]
+    #[rustc_allow_const_fn_unstable(const_fn_transmute)]
     pub const fn as_bytes(&self) -> &[u8] {
         // SAFETY: const sound because we transmute two types with the same layout
         unsafe { mem::transmute(self) }
@@ -1132,6 +1131,13 @@ pub fn rfind<'a, P>(&'a self, pat: P) -> Option<usize>
     /// assert_eq!(v, ["lion", "tiger", "leopard"]);
     /// ```
     ///
+    /// If the pattern is a slice of chars, split on each occurrence of any of the characters:
+    ///
+    /// ```
+    /// let v: Vec<&str> = "2020-11-03 23:59".split(&['-', ' ', ':', '@'][..]).collect();
+    /// assert_eq!(v, ["2020", "11", "03", "23", "59"]);
+    /// ```
+    ///
     /// A more complex pattern, using a closure:
     ///
     /// ```
@@ -2253,9 +2259,9 @@ pub fn eq_ignore_ascii_case(&self, other: &str) -> bool {
     /// but non-ASCII letters are unchanged.
     ///
     /// To return a new uppercased value without modifying the existing one, use
-    /// [`to_ascii_uppercase`].
+    /// [`to_ascii_uppercase()`].
     ///
-    /// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
+    /// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase
     ///
     /// # Examples
     ///
@@ -2280,9 +2286,9 @@ pub fn make_ascii_uppercase(&mut self) {
     /// but non-ASCII letters are unchanged.
     ///
     /// To return a new lowercased value without modifying the existing one, use
-    /// [`to_ascii_lowercase`].
+    /// [`to_ascii_lowercase()`].
     ///
-    /// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
+    /// [`to_ascii_lowercase()`]: #method.to_ascii_lowercase
     ///
     /// # Examples
     ///