Skip to content
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

Rust clippy172 v1 #9418

Closed
wants to merge 2 commits into from
Closed

Conversation

catenacyber
Copy link
Contributor

Link to redmine ticket:
None

Describe changes:

  • Fix clippy 1.72 warnings

@jasonish how can we prevent CI from going red when clippy 1.73 will be out ?

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #9418 (45036b0) into master (becb8ce) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9418      +/-   ##
==========================================
- Coverage   82.17%   82.14%   -0.04%     
==========================================
  Files         968      968              
  Lines      274198   274199       +1     
==========================================
- Hits       225331   225230     -101     
- Misses      48867    48969     +102     
Flag Coverage Δ
fuzzcorpus 64.03% <80.00%> (+<0.01%) ⬆️
suricata-verify 60.87% <100.00%> (-0.02%) ⬇️
unittests 62.88% <87.50%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@jasonish
Copy link
Member

@jasonish how can we prevent CI from going red when clippy 1.73 will be out ?

We could pin clippy to a version, and making updating it a manual process.

@jasonish jasonish mentioned this pull request Aug 30, 2023
@catenacyber
Copy link
Contributor Author

Clippy nightly does not give the newt warnings somehow ?

@jasonish
Copy link
Member

Clippy nightly does not give the newt warnings somehow ?

I don't think we should run nightly for linting. By definition lints that it produces may not be fixable without suppression in our MSRV, or could change from night to night as they realize mistakes were made.

@suricata-qa
Copy link

WARNING:

field baseline test %
SURI_TLPW2_autofp_stats_chk
.flow.spare 1951025 2162602 110.84%

Pipeline 15787

@catenacyber
Copy link
Contributor Author

We could pin clippy to a version, and making updating it a manual process.

Not perfect either...

@catenacyber
Copy link
Contributor Author

Jason has also one commit to upgrade the crate bit flags cf 6b6c598

@@ -84,7 +84,7 @@ pub fn detect_parse_iprep(i: &str) -> IResult<&str, DetectIPRepData> {
let (i, name) = take_while(is_alphanumeric_or_slash)(i)?;
// copy as to have final zero
let namez = CString::new(name).unwrap();
let cat = unsafe { SRepCatGetByShortname(namez.as_ptr() as *const i8) };
let cat = unsafe { SRepCatGetByShortname(namez.as_ptr()) };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives errors on my arm builders:

   Compiling suricata v7.0.1-dev (/builds/inliniac/suricata-ci/suricata/rust)
error[E0308]: mismatched types
  --> src/detect/iprep.rs:87:46
   |
87 |     let cat = unsafe { SRepCatGetByShortname(namez.as_ptr()) };
   |                        --------------------- ^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
   |                        |
   |                        arguments to this function are incorrect
   |
   = note: expected raw pointer `*const i8`
              found raw pointer `*const u8`
note: function defined here
  --> src/detect/iprep.rs:74:12
   |
74 |     pub fn SRepCatGetByShortname(name: *const i8) -> u8;
   |            ^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `suricata` (lib) due to previous error


   Compiling suricata v7.0.1-dev (/builds/inliniac/suricata-ci/suricata/rust)
error[E0308]: mismatched types
  --> src/detect/iprep.rs:87:46
   |
87 |     let cat = unsafe { SRepCatGetByShortname(namez.as_ptr()) };
   |                        --------------------- ^^^^^^^^^^^^^^ expected `i8`, found `u8`
   |                        |
   |                        arguments to this function are incorrect
   |
   = note: expected raw pointer `*const i8`
              found raw pointer `*const u8`
note: function defined here
  --> src/detect/iprep.rs:74:12
   |
74 |     pub fn SRepCatGetByShortname(name: *const i8) -> u8;
   |            ^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `suricata` due to previous error

Not sure why the 2 errors are different, perhaps rustc version differences.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC C type char is unsigned in arm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed

Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see inline comments

@catenacyber catenacyber mentioned this pull request Sep 4, 2023
@catenacyber
Copy link
Contributor Author

Replaced by #9433

@catenacyber catenacyber closed this Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants