mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 03:23:25 +00:00
Clarify Path::extension() semantics in docs abstract
State up-front and center what shape the returned extension will have, without making the user read through the description and examples. Rationale: Various frameworks and libraries for different platforms have their different conventions as to whether an "extension" is ".ext" or just "ext" and anyone that's had to deal with this ambiguity in the past is always double- or triple-checking to make sure the function call returns an extension that matches the expected semantics. Offer the answer to this important question right off the bat instead of making them dig to find it.
This commit is contained in:
parent
4136b59b7d
commit
c291d2adec
@ -2401,7 +2401,7 @@ impl Path {
|
||||
self.file_name().map(split_file_at_dot).and_then(|(before, _after)| Some(before))
|
||||
}
|
||||
|
||||
/// Extracts the extension of [`self.file_name`], if possible.
|
||||
/// Extracts the extension (without the leading dot) of [`self.file_name`], if possible.
|
||||
///
|
||||
/// The extension is:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user