diff --git a/library/std/src/path.rs b/library/std/src/path.rs index e3d529df7de1643732b64071a1fd5bf527d4ffde..afdbdbeac3e54a12e2c5ef85c36c67c258cd31b1 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2057,9 +2057,14 @@ fn _starts_with(&self, base: &Path) -> bool { /// ``` /// use std::path::Path; /// - /// let path = Path::new("/etc/passwd"); + /// let path = Path::new("/etc/resolv.conf"); + /// + /// assert!(path.ends_with("resolv.conf")); + /// assert!(path.ends_with("etc/resolv.conf")); + /// assert!(path.ends_with("/etc/resolv.conf")); /// - /// assert!(path.ends_with("passwd")); + /// assert!(!path.ends_with("/resolv.conf")); + /// assert!(!path.ends_with("conf")); // use .extension() instead /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn ends_with>(&self, child: P) -> bool {