diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 392c815ef28..bc24c1e65c8 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2112,6 +2112,11 @@ impl Path { /// let path = Path::new("/etc/passwd"); /// /// assert!(path.ends_with("passwd")); + /// assert!(path.ends_with("etc/passwd")); + /// assert!(path.ends_with("/etc/passwd")); + /// + /// assert!(!path.ends_with("/passwd")); + /// assert!(!path.ends_with("wd")); // use .extension() instead /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn ends_with>(&self, child: P) -> bool {