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:
Mahmoud Al-Qudsi 2022-09-20 11:12:03 -05:00
parent 4136b59b7d
commit c291d2adec

View file

@ -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:
///