-
Notifications
You must be signed in to change notification settings - Fork 37
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
Allow copying File Options Again #24
Allow copying File Options Again #24
Conversation
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.
Mostly looks good, but I have some nitpicks.
51739f5
to
16f9e53
Compare
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.
Almost perfect! I prefer methods to return a borrow rather than a clone, so that the caller can decide whether to clone it.
The build currently fails; could you please fix it? You may need to build with --all-features and with --no-default-features to reproduce the errors. Also, this PR raises a Clippy error:
|
src/write.rs
Outdated
|
||
trait Sealed {} | ||
/// File options Extensions | ||
#[allow(private_bounds)] |
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.
Please add #[allow(unknown_lints)] as well, since this lint didn't exist in 1.70 (the current MSRV).
Hi, It turns out that having a public trait extend a private trait was actually an error until Rust 1.74 (rust-lang/rust#113126, https://doc.rust-lang.org/error_codes/E0445.html) which has only been stable since November. Is there another way you can implement the sealing so that we don't have to bump the MSRV that far? |
src/write.rs
Outdated
#[allow(unknown_lints)] | ||
#[allow(private_bounds)] | ||
#[doc(hidden)] | ||
pub trait FileOptionExtension: Default + Sealed { |
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.
This turns out not to be allowed before 1.74.0, and the current MSRV is 1.70.0. To fix this, make Sealed a public member of a private module; see https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/#sealing-traits-with-a-supertrait and https://doc.rust-lang.org/error_codes/E0445.html#.
I think this works |
Thanks; this will be merged automatically provided the tests pass. |
Whoops, looks like some of your commits aren't signed! I'd suggest squashing the PR so that you only have to sign one. |
Please stop merging every commit into my PR. A. I rather use Rebase If you are not doing that. Then what is Github doing? I have never had a PR auto-merge commits like this. |
Head branch was pushed to by a user without write access
e297804
to
6ff56b5
Compare
After your squash and force-push, I'm still seeing: "Merging is blocked This indicates that GitHub still doesn't recognize your signature. When it's recognized, you'll be able to see a Verified badge on the commit on the source branch's page. |
6ff56b5
to
61afe4d
Compare
This repo's main branch has the "Require branches to be up to date before merging" rule, to prevent merging two PRs that were compatible with their last common ancestor but not with each other (e.g. because they add different new functions with the same name). |
Yeah I had done it in two separate actions. I have never setup Git Signing before. So It took me a moment. |
Please don't close and reopen the PR unless you've rebased it, because then the CI checks are ignored and I have to manually approve them to start again. (If you've rebased it, then it's fine, because I'd have to restart them anyway.) |
It looks like displaying a "Rebase branch" button instead of "Update branch" is in a lot of people's wish lists: https://github.com/orgs/community/discussions/3245 In future, I'll try to remember to check whether rebasing is an option; but it may not be if it would invalidate your signatures. (You'd think that if that happened, GitHub would be able to replace the signatures with ones of its own; not sure why that isn't implemented.) |
I just wish it would block it. Let me handle the merge or rebase. Don't do it automatically. |
That means the CI can't run until you've rebased and I've approved the rebase to have the CI run on it, so PRs would take even longer to be merged. Plus, I may not be able to check PRs daily in the future -- I'm currently on leave from work, but will be either returning to full-time work or searching for a new job starting in early May, which may cause further delays. This is especially true if https://github.com/orgs/community/discussions/119719 and https://github.com/orgs/community/discussions/119723 turn out not to be the last issues of their kind that I'll get temporarily stuck on, or if #26 and #27 aren't the last config changes I'll discover a need for while others' PRs are waiting on CI. I'm fairly new at receiving PRs from other humans on a repo in parallel with each other and with my own work on the same repo, so there may be a lot of gotchas I've yet to discover. Please continue to be patient. |
Thanks! This is now merged, and I expect to release it in version 1.1.0 within the next few days. |
When
extra_data
andcentral_extra_data
were added to FileOptions we lost the ability to implement Copy for FileOptions.Plenty of people will want to Zip a basic set of files. But now we have an unnecessary Atomic value being incremented and decremented. Also an empty allocation inside the Vec
So this solution has FileOptions take a Generic Parameter to hold "Extra Options" This can be the Unit type or ExtendedFileOptions
This also puts extra_data and central_extra_data in an Option inside ZipFileData removing the Atomic usage in some cases there too.
This does break the current code as people will need to specify the generic parameter or change FileOptions to either SimpleFileOptions or FullFileOptions
I also corrected the write_dir test to remove the deprecated API calls