Document an edge case of str::split_once

This commit is contained in:
Imbolc 2022-06-13 13:35:49 +03:00 committed by GitHub
parent 083721a1a7
commit acda8866cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1632,6 +1632,7 @@ impl str {
/// ///
/// ``` /// ```
/// assert_eq!("cfg".split_once('='), None); /// assert_eq!("cfg".split_once('='), None);
/// assert_eq!("cfg=".split_once('='), Some(("cfg", "")));
/// assert_eq!("cfg=foo".split_once('='), Some(("cfg", "foo"))); /// assert_eq!("cfg=foo".split_once('='), Some(("cfg", "foo")));
/// assert_eq!("cfg=foo=bar".split_once('='), Some(("cfg", "foo=bar"))); /// assert_eq!("cfg=foo=bar".split_once('='), Some(("cfg", "foo=bar")));
/// ``` /// ```