-
Notifications
You must be signed in to change notification settings - Fork 838
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
Fix clippy lint dead_code
#1324
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.
Thanks for keeping things moving forward @gsserge !
@@ -97,6 +97,7 @@ pub struct Writer<W: Write> { | |||
/// The object to write to | |||
writer: csv_crate::Writer<W>, | |||
/// Column delimiter. Defaults to `b','` | |||
#[allow(dead_code)] |
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 seems a bug (not to use the delimiter option) . I think we should add a note or fix.
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.
Yep, this time the delimiter is configured via the builder, but gets completely ignored
impl<W: Write> Writer<W> {
/// Create a new CsvWriter from a writable object, with default options
pub fn new(writer: W) -> Self {
let delimiter = b',';
let mut builder = csv_crate::WriterBuilder::new();
let writer = builder.delimiter(delimiter).from_writer(writer);
...
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.
@@ -1055,6 +1056,7 @@ pub struct ReaderBuilder { | |||
/// The default batch size when using the `ReaderBuilder` is 1024 records | |||
batch_size: usize, | |||
/// The bounds over which to scan the reader. `None` starts from 0 and runs until EOF. | |||
#[allow(dead_code)] |
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 bug?
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.
To me it looks more like an omission in the builder. Reader::from_csv_reader()
correctly processes the bounds
parameter.
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.
Cool that enabling this lint reveals real issues, so it is actually very beneficial for everyone to be careful with |
Codecov Report
@@ Coverage Diff @@
## master #1324 +/- ##
==========================================
+ Coverage 83.00% 83.03% +0.02%
==========================================
Files 180 180
Lines 52919 52919
==========================================
+ Hits 43924 43939 +15
+ Misses 8995 8980 -15
Continue to review full report at Codecov.
|
I think this is a great strategy. Thank you @gsserge for filing the follow on issues |
@@ -536,6 +536,7 @@ mod tests { | |||
assert!(iter.next().is_none()); | |||
} | |||
|
|||
#[test] |
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.
👍 nice fix
@@ -107,6 +108,7 @@ pub struct Writer<W: Write> { | |||
/// The timestamp format for timestamp arrays | |||
timestamp_format: String, | |||
/// The timestamp format for timestamp (with timezone) arrays |
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.
fyi @sum12
Here is a PR that removes some more of this discovered dead code: #1331 |
Which issue does this PR close?
Closes #1255
Rationale for this change
It's beneficial to run clippy and compiler lints as strict as possible.
What changes are included in this PR?
This PR drops
#![allow(dead_code)]
, which is the last top levelallow
attribute in thearrow
crate. Unfortunately, it's the most difficult one to deal with, because there's a lot of code that exists and sometimes even has tests, but it's neither pub exported nor used anywhere. I don't feel comfortable removing it (except for the obvious cases like the unused time consts), that's why I've decided to use local#[allow(dead_code)]
instead. The existing code is left intact, because it might be needed in the future, while overall the linting process gets more strict.Are there any user-facing changes?
No.