-
Notifications
You must be signed in to change notification settings - Fork 1.9k
build: modify code to comply with latest clippy requirement #9725
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
Conversation
| use std::fs::OpenOptions; | ||
| use std::io::{Read, Write}; | ||
|
|
||
| #[allow(clippy::suspicious_open_options)] |
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.
@waynexia please check this
I suppressed the warning but clippy requires .truncate to be called before file creation
--> datafusion/substrait/src/serializer.rs:32:39
|
32 | let mut file = OpenOptions::new().create(true).write(true).open(path)?;
| ^^^^^^^^^^^^- help: add: `.truncate(true)`
|
= help: if you intend to overwrite an existing file entirely, call `.truncate(true)`
= help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
= help: alternatively, use `.append(true)` to append to the file instead of overwriting it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_open_options
= note: `-D clippy::suspicious-open-options` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::suspicious_open_options)]`
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.
Filed #9727 to track
alamb
left a comment
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.
Thank you @comphead -- much appreciated 🙏
|
|
||
| assert_eq!(std::mem::size_of::<ScalarValue>(), 48); | ||
| // The value can be changed depending on rust version | ||
| assert_eq!(std::mem::size_of::<ScalarValue>(), 64); |
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 is an interesting change -- basically it means that all ScalarValue based code will potentially consume significantly more memory (as now each ScalarValue takes 64 bytes rather than 48). Interestingly, this is the same behavior as aarch64 in previous rust versions (you can see this test is cfg'd off with
#[cfg(not(target_arch = "aarch64"))]I'll make a follow on PR to remove this cfg
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.
| use std::fs::OpenOptions; | ||
| use std::io::{Read, Write}; | ||
|
|
||
| #[allow(clippy::suspicious_open_options)] |
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.
Filed #9727 to track
|
Merging this in to get CI passing on main again. Let's handle additional changes in followups |
Which issue does this PR close?
Closes #9724 .
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?