Skip to content

Commit

Permalink
Clarify Path::extension() semantics in docs abstract
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mqudsi committed Sep 20, 2022
1 parent 4136b59 commit c291d2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
///
Expand Down

0 comments on commit c291d2a

Please sign in to comment.