Skip to content

Commit 77d063b

Browse files
authored
Rollup merge of #102058 - mqudsi:path_extension_docs, r=thomcc
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. This is a doc-only change. There are no changes to the API contract and the clarification is in line with what was already stated/promised in the existing doc text - just clarified, summarized, and served bright and early. 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. ```@rustbot``` label +A-docs
2 parents 7d7f555 + c291d2a commit 77d063b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ impl Path {
24012401
self.file_name().map(split_file_at_dot).and_then(|(before, _after)| Some(before))
24022402
}
24032403

2404-
/// Extracts the extension of [`self.file_name`], if possible.
2404+
/// Extracts the extension (without the leading dot) of [`self.file_name`], if possible.
24052405
///
24062406
/// The extension is:
24072407
///

0 commit comments

Comments
 (0)