clippy-action icon indicating copy to clipboard operation
clippy-action copied to clipboard

different clippy behaviour locally and in CI

Open danieleades opened this issue 2 years ago • 2 comments

i'm seeing quite different output from clippy in CI and locally. Any ideas?

output in CI - https://github.com/jhelovuo/RustDDS/actions/runs/4210445465/jobs/7308142488

output from local clippy run-

cargo +nightly clippy --all --all-targets                                       
warning: associated function `data` is never used
  --> src/dds/ddsdata.rs:73:10
   |
73 |   pub fn data(&self) -> Bytes {
   |          ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: associated function `payload_bytes` is never used
  --> src/dds/ddsdata.rs:78:6
   |
78 |   fn payload_bytes(&self) -> Bytes {
   |      ^^^^^^^^^^^^^

warning: associated function `get_reader_and_history_cache_change` is never used
   --> src/dds/message_receiver.rs:129:6
    |
129 |   fn get_reader_and_history_cache_change(
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: associated function `get_reader_and_history_cache_change_object` is never used
   --> src/dds/message_receiver.rs:146:6
    |
146 |   fn get_reader_and_history_cache_change_object(
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: associated function `history_cache_change_data` is never used
   --> src/dds/reader.rs:291:10
    |
291 |   pub fn history_cache_change_data(&self, sequence_num...
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: `rustdds` (lib test) generated 5 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
warning: the following packages contain code that will be rejected by a future version of Rust: traitobject v0.1.0
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`

note the errors present in CI that aren't present in local run

danieleades avatar Feb 18 '23 12:02 danieleades

I ran clippy on my local machine, but it shows different outputs and seems to be similar to CI output. I tried versions below:

➜ RustDDS master ✓ git rev-parse master
692841bfa4040cd53e07054c65b5d0dcc8bffed5
➜ RustDDS master ✓ cargo +nightly --version
cargo 1.69.0-nightly (17b3d0de0 2023-02-17)
my output
➜ RustDDS master ✓ git rev-parse master
692841bfa4040cd53e07054c65b5d0dcc8bffed5
➜ RustDDS master ✓ cargo +nightly --version
cargo 1.69.0-nightly (17b3d0de0 2023-02-17)
➜ RustDDS master ✓ cargo +nightly clippy --all --all-targets 
    Checking rustdds v0.7.11 (/Users/giraffate/workspace/RustDDS)
warning: unused import: `byteorder::LittleEndian`
   --> src/dds/message_receiver.rs:427:7
    |
427 |   use byteorder::LittleEndian;
    |       ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_imports)]` on by default

warning: unused imports: `Deserialize`, `Serialize`
   --> src/dds/message_receiver.rs:429:15
    |
429 |   use serde::{Deserialize, Serialize};
    |               ^^^^^^^^^^^  ^^^^^^^^^

warning: unused imports: `WriterCommand`, `WriterIngredients`, `Writer`, `cdr_deserializer::deserialize_from_little_endian`, `cdr_serializer::to_bytes`, `sequence_number::SequenceNumber`
   --> src/dds/message_receiver.rs:439:16
    |
439 |       writer::{Writer, WriterCommand, WriterIngredients},
    |                ^^^^^^  ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^
...
443 |     serialization::{cdr_deserializer::deserialize_from_little_endian, cdr_serializer::to_bytes},
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^^^
444 |     structure::{dds_cache::DDSCache, guid::EntityKind, sequence_number::SequenceNumber},
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this public function might dereference a raw pointer but is not marked `unsafe`
   --> src/messages/submessages/submessage_elements/serialized_payload.rs:9:45
    |
9   | #[derive(Debug, PartialEq, Eq, Clone, Copy, Readable, Writable)]
    |                                             ^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
note: the lint level is defined here
   --> src/lib.rs:135:9
    |
135 | #![deny(clippy::all)]
    |         ^^^^^^^^^^^
    = note: `#[deny(clippy::not_unsafe_ptr_arg_deref)]` implied by `#[deny(clippy::all)]`
    = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
  --> src/structure/duration.rs:15:3
   |
15 |   Readable,
   |   ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
   = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
   --> src/structure/guid.rs:476:3
    |
476 |   Readable,
    |   ^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
    = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
  --> src/structure/time.rs:32:42
   |
32 |   Debug, PartialEq, Eq, PartialOrd, Ord, Readable, Writable, Clone, Copy, Serialize, Deserialize,
   |                                          ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
   = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
  --> src/structure/rpc.rs:21:3
   |
21 |   Readable,
   |   ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
   = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
  --> src/structure/rpc.rs:65:51
   |
65 |   Clone, Default, PartialOrd, PartialEq, Ord, Eq, Readable, Writable, Hash, Serialize, Deserialize,
   |                                                   ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
   = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

error: this public function might dereference a raw pointer but is not marked `unsafe`
  --> src/structure/rpc.rs:73:51
   |
73 |   Clone, Default, PartialOrd, PartialEq, Ord, Eq, Readable, Writable, Hash, Serialize, Deserialize,
   |                                                   ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
   = note: this error originates in the derive macro `Readable` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: associated function `data` is never used
  --> src/dds/ddsdata.rs:73:10
   |
73 |   pub fn data(&self) -> Bytes {
   |          ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: associated function `payload_bytes` is never used
  --> src/dds/ddsdata.rs:78:6
   |
78 |   fn payload_bytes(&self) -> Bytes {
   |      ^^^^^^^^^^^^^

warning: associated function `get_reader_and_history_cache_change` is never used
   --> src/dds/message_receiver.rs:129:6
    |
129 |   fn get_reader_and_history_cache_change(
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: associated function `get_reader_and_history_cache_change_object` is never used
   --> src/dds/message_receiver.rs:146:6
    |
146 |   fn get_reader_and_history_cache_change_object(
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: associated function `history_cache_change_data` is never used
   --> src/dds/reader.rs:291:10
    |
291 |   pub fn history_cache_change_data(&self, sequence_number: SequenceNumber) -> Option<DDSData> {
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `rustdds` due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
warning: `rustdds` (lib test) generated 8 warnings
error: could not compile `rustdds` due to 7 previous errors; 8 warnings emitted

giraffate avatar Feb 21 '23 13:02 giraffate

how strange... i'm using the same commit and the same toolchain.

thanks for checking!

beats the hell out of me

danieleades avatar Feb 21 '23 21:02 danieleades