Skip to content

chore: file.rs - Remove add_dummy_extension() helper #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

polarathene
Copy link
Collaborator

The helper method is redundant (introduced as a bug fix in Mar 2022), there is a much simpler approach to append the extension.

as_mut_os_string() has been available since Rust 1.70.0, which fits this crates MSRV that is already leveraging OnceLock (since Oct 2024 / 0.14.1 release).

This helper method is redundant, there is a much simpler approach to append the extension.
@polarathene
Copy link
Collaborator Author

Lint failure is about the commit title length exceeding 72 chars. I can correct that later, although I rather the project just adopt squash merge commits 😅

@epage
Copy link
Contributor

epage commented Aug 15, 2025

. I can correct that later, although I rather the project just adopt squash merge commits 😅

I have a strong distaste for squashing commits as it loses valuable information on how changes are constructed, instead preferring people to contribute clean, atomic commits. However, that doesn't mean you have to go in and edit the message. That job is non-blocking and the lint output says to not stress too much over it.

Comment on lines -62 to -63
// Adding a dummy extension will make sure we will not override secondary extensions, i.e. "file.local"
// This will make the following set_extension function calls to append the extension.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer the original comment

@polarathene
Copy link
Collaborator Author

polarathene commented Aug 16, 2025

I have a strong distaste for squashing commits as it loses valuable information on how changes are constructed, instead preferring people to contribute clean, atomic commits.

That's alright, I encountered the same stance with the prior project maintainer back in 2023 where I explained why I disagree.

I find squash commits much more appropriate and cleaner in commit history personally, but only when you have the associated platform (GitHub) accessible. Since it's not uncommon for commits to make such references or delegate valuable information at the PR reviews or issues, the commit history often lacks that.

I do appreciate atomic commits, be that via rebase merge or the PR commit history being tidied up before a squash merge. The default merge commit strategy however is rather bad UX to navigate the history/log (which I often do via web UI along with it's equivalent git blame instead of cloning each project to inspect).


However, that doesn't mean you have to go in and edit the message. That job is non-blocking and the lint output says to not stress too much over it.

👍 Good to know, but then is that worth keeping? (I briefly raised the same question in 2023)

Due to the comment change request, I'll likely have to squash commit history anyway (one of the bonuses of merge commit for me as a maintainer is that contributors could easily iterate or I could apply suggestions myself and bundle that up without an interactive rebase, and I say this as probably one of the very few that properly leverages commit history on that project over the years 😅)

// This will make the following set_extension function calls to append the extension.
let mut filename = add_dummy_extension(filename);

// Append an extension that will be replaced when calling `set_extension()`:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a better revision?

Suggested change
// Append an extension that will be replaced when calling `set_extension()`:
// Add a fake extension which will be replaced by `set_extension()` calls.
// Prevents accidentally replacing a portion of the base filename with an existing `.` (ref: #306)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants