-
Notifications
You must be signed in to change notification settings - Fork 243
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
base: main
Are you sure you want to change the base?
Conversation
This helper method is redundant, there is a much simpler approach to append the extension.
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 😅 |
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. |
// 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. |
There was a problem hiding this comment.
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
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
👍 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()`: |
There was a problem hiding this comment.
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?
// 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) |
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 leveragingOnceLock
(since Oct 2024 /0.14.1
release).