about summary refs log tree commit diff
path: root/library/std/src/path.rs
diff options
context:
space:
mode:
authorThe 8472 <git@infinite-source.de>2025-08-05 22:56:43 +0200
committerThe 8472 <git@infinite-source.de>2025-08-05 22:56:43 +0200
commitd8e8a5e8b4867cdc48b98c0126807267a6258e70 (patch)
treebaeca8603d08e3277c0537896cab7b44f95c4744 /library/std/src/path.rs
parent213d946a384b46989f6fd9c8ae9c547b4e354455 (diff)
downloadrust-d8e8a5e8b4867cdc48b98c0126807267a6258e70.tar.gz
rust-d8e8a5e8b4867cdc48b98c0126807267a6258e70.zip
add code example showing that file_prefix treats dotfiles as the name of a file, not an extension
Diffstat (limited to 'library/std/src/path.rs')
-rw-r--r--library/std/src/path.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 055e7f81480..e7ba6936435 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