about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-08-06 21:29:31 +0200
committerGitHub <noreply@github.com>2025-08-06 21:29:31 +0200
commit09de71b61c931af799b064e4c377ffecf78b6ad7 (patch)
treeee59b4a608d6dfbe27afa2d867ab393a8e821b83 /library/std/src
parentde6c639228a8fdadfb2b7b0d4c7ef80848d3643d (diff)
parentd8e8a5e8b4867cdc48b98c0126807267a6258e70 (diff)
downloadrust-09de71b61c931af799b064e4c377ffecf78b6ad7.tar.gz
rust-09de71b61c931af799b064e4c377ffecf78b6ad7.zip
Rollup merge of #144972 - the8472:file-prefix-docs, r=joshtriplett
add code example showing that file_prefix treats dotfiles as the name of a file, not an extension

This came up in a libs-api meeting while we were reviewing rust-lang/rust#144870
Diffstat (limited to 'library/std/src')
-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