about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-22 05:19:48 +0000
committerbors <bors@rust-lang.org>2021-08-22 05:19:48 +0000
commit2ad56d5c9031636c1509f4417e88099a49405b4e (patch)
tree365f66542bcc32a01533bd522669f0dd0dc2b87a /compiler/rustc_parse/src/parser/expr.rs
parent50731df24e584e8ebc0097497169b431c005bf86 (diff)
parent51cf318dbcdd38d6a7478413513a72097d9622c3 (diff)
downloadrust-2ad56d5c9031636c1509f4417e88099a49405b4e.tar.gz
rust-2ad56d5c9031636c1509f4417e88099a49405b4e.zip
Auto merge of #85166 - mbhall88:file-prefix, r=dtolnay
add file_prefix method to std::path

This is an initial implementation of `std::path::Path::file_prefix`. It is effectively a "left" variant of the existing [`file_stem`](https://doc.rust-lang.org/std/path/struct.Path.html#method.file_stem) method. An illustration of the difference is

```rust
use std::path::Path;

let path = Path::new("foo.tar.gz");
assert_eq!(path.file_stem(), Some("foo.tar"));
assert_eq!(path.file_prefix(), Some("foo"));
```

In my own development, I generally find I almost always want the prefix, rather than the stem, so I thought it might be best to suggest it's addition to libstd.

Of course, as this is my first contribution, I expect there is probably more work that needs to be done. Additionally, if the libstd team feel this isn't appropriate then so be it.

There has been some [discussion about this on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/file_lstem/near/238076313) and a user there suggested I open a PR to see whether someone in the libstd team thinks it is worth pursuing.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions