build: modify code to comply with latest clippy requirement#9725
Merged
alamb merged 4 commits intoapache:mainfrom Mar 21, 2024
Merged
build: modify code to comply with latest clippy requirement#9725alamb merged 4 commits intoapache:mainfrom
alamb merged 4 commits intoapache:mainfrom
Conversation
comphead
commented
Mar 21, 2024
| use std::fs::OpenOptions; | ||
| use std::io::{Read, Write}; | ||
|
|
||
| #[allow(clippy::suspicious_open_options)] |
Contributor
Author
There was a problem hiding this comment.
@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)]`
This was referenced Mar 21, 2024
alamb
approved these changes
Mar 21, 2024
|
|
||
| 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); |
Contributor
There was a problem hiding this comment.
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
| use std::fs::OpenOptions; | ||
| use std::io::{Read, Write}; | ||
|
|
||
| #[allow(clippy::suspicious_open_options)] |
Contributor
|
Merging this in to get CI passing on main again. Let's handle additional changes in followups |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?