From d8e8a5e8b4867cdc48b98c0126807267a6258e70 Mon Sep 17 00:00:00 2001 From: The 8472 Date: Tue, 5 Aug 2025 22:56:43 +0200 Subject: [PATCH] add code example showing that file_prefix treats dotfiles as the name of a file, not an extension --- library/std/src/path.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 055e7f814800d..e7ba693643581 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2683,6 +2683,8 @@ impl Path { /// /// assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap()); /// assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap()); + /// assert_eq!(".config", Path::new(".config").file_prefix().unwrap()); + /// assert_eq!(".config", Path::new(".config.toml").file_prefix().unwrap()); /// ``` /// /// # See Also