Updated to non path dependency for bp3d-logger #19
clippy
1 error, 17 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 1 |
Warning | 17 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.77.0 (aedd173a2 2024-03-17)
- cargo 1.77.0 (3fe68eabf 2024-02-29)
- clippy 0.1.77 (aedd173 2024-03-17)
Annotations
Check warning on line 183 in src/lib.rs
github-actions / clippy
you should consider adding a `Default` implementation for `DisableStdoutLogger`
warning: you should consider adding a `Default` implementation for `DisableStdoutLogger`
--> src/lib.rs:174:5
|
174 | / pub fn new() -> DisableStdoutLogger {
175 | | if STDOUT_DISABLE_RC.fetch_add(1, Ordering::Relaxed) == 0 {
176 | | //If no previous instances were created, disable the stdout/stderr logger.
177 | | //First, flush any waiting message.
... |
182 | | DisableStdoutLogger
183 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
|
172 + impl Default for DisableStdoutLogger {
173 + fn default() -> Self {
174 + Self::new()
175 + }
176 + }
|
Check warning on line 148 in src/lib.rs
github-actions / clippy
you should consider adding a `Default` implementation for `LogBuffer`
warning: you should consider adding a `Default` implementation for `LogBuffer`
--> src/lib.rs:142:5
|
142 | / pub fn new() -> LogBuffer {
143 | | if LOG_BUFFER_RC.fetch_add(1, Ordering::Relaxed) == 0 {
144 | | //If no previous buffers were created, enable the log buffer.
145 | | bp3d_logger::enable_log_buffer();
146 | | }
147 | | LogBuffer(())
148 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
140 + impl Default for LogBuffer {
141 + fn default() -> Self {
142 + Self::new()
143 + }
144 + }
|
Check warning on line 120 in src/lib.rs
github-actions / clippy
needless `fn main` in doctest
warning: needless `fn main` in doctest
--> src/lib.rs:117:5
|
117 | /// fn main() {
| _____^
118 | | /// bp3d_tracing::setup!("my-super-app");
119 | | /// // ... application code goes here
120 | | /// }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
= note: `#[warn(clippy::needless_doctest_main)]` on by default
Check warning on line 247 in src/profiler/thread/core.rs
github-actions / clippy
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> src/profiler/thread/core.rs:242:17
|
242 | / match cmd.unwrap() {
243 | | command::Control::Terminate => {
244 | | return;
245 | | },
246 | | _ => ()
247 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
242 ~ if let command::Control::Terminate = cmd.unwrap() {
243 + return;
244 + }
|
Check warning on line 244 in src/profiler/thread/core.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/profiler/thread/core.rs:243:53
|
243 | command::Control::Terminate => {
| _____________________________________________________^
244 | | return;
| |______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
|
243 - command::Control::Terminate => {
244 - return;
243 + command::Control::Terminate => {
|
Check failure on line 200 in src/profiler/thread/core.rs
github-actions / clippy
written amount is not handled
error: written amount is not handled
--> src/profiler/thread/core.rs:200:5
|
200 | client.write(&bytes).await?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `AsyncWriteExt::write_all` instead, or handle partial writes
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
= note: `#[deny(clippy::unused_io_amount)]` on by default
Check warning on line 247 in src/profiler/network_types/message.rs
github-actions / clippy
this lifetime isn't used in the impl
warning: this lifetime isn't used in the impl
--> src/profiler/network_types/message.rs:247:6
|
247 | impl<'a> Msg for SpanDataset {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
Check warning on line 17 in src/profiler/network_types/log.rs
github-actions / clippy
name `BOOL` contains a capitalized acronym
warning: name `BOOL` contains a capitalized acronym
--> src/profiler/network_types/log.rs:17:5
|
17 | BOOL = 11,
| ^^^^ help: consider making the acronym lowercase, except the initial letter: `Bool`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
Check warning on line 16 in src/profiler/network_types/log.rs
github-actions / clippy
name `STR` contains a capitalized acronym
warning: name `STR` contains a capitalized acronym
--> src/profiler/network_types/log.rs:16:5
|
16 | STR = 10,
| ^^^ help: consider making the acronym lowercase, except the initial letter: `Str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
= note: `#[warn(clippy::upper_case_acronyms)]` on by default
Check warning on line 163 in src/profiler/network_types/deserializer.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> src/profiler/network_types/deserializer.rs:163:12
|
163 | if self.buffer().len() == 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.buffer().is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
Check warning on line 128 in src/logger.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> src/logger.rs:128:30
|
128 | bp3d_logger::raw_log(&msg);
| ^^^^ help: change this to: `msg`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 168 in src/core.rs
github-actions / clippy
using `clone` on type `SpanId` which implements the `Copy` trait
warning: using `clone` on type `SpanId` which implements the `Copy` trait
--> src/core.rs:168:30
|
168 | stack.last().map(|v| v.id.clone())
| ^^^^^^^^^^^^ help: try removing the `clone` call: `v.id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
Check warning on line 142 in src/core.rs
github-actions / clippy
initializer for `thread_local` value can be made `const`
warning: initializer for `thread_local` value can be made `const`
--> src/core.rs:142:50
|
142 | static SPAN_STACK: RefCell<Vec<SpanLocal>> = RefCell::new(Vec::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(Vec::new()) }`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const
= note: `#[warn(clippy::thread_local_initializer_can_be_made_const)]` on by default
Check warning on line 39 in src/config/mod.rs
github-actions / clippy
the borrowed expression implements the required traits
warning: the borrowed expression implements the required traits
--> src/config/mod.rs:39:52
|
39 | if let Ok(v) = std::fs::read_to_string(&v) {
| ^^ help: change this to: `v`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
Check warning on line 144 in src/config/model.rs
github-actions / clippy
this `impl` can be derived
warning: this `impl` can be derived
--> src/config/model.rs:136:1
|
136 | / impl Default for Config {
137 | | fn default() -> Self {
138 | | Self {
139 | | mode: None,
... |
143 | | }
144 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` on by default
= help: remove the manual implementation...
help: ...and instead derive it
|
130 + #[derive(Default)]
131 | pub struct Config {
|
Check warning on line 55 in src/config/model.rs
github-actions / clippy
methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
warning: methods with the following characteristics: (`to_*` and `self` type is `Copy`) usually take `self` by value
--> src/config/model.rs:55:23
|
55 | pub fn to_tracing(&self) -> tracing_core::Level {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[warn(clippy::wrong_self_convention)]` on by default
Check warning on line 88 in src/util.rs
github-actions / clippy
methods `into_u64` and `get_id_instance` are never used
warning: methods `into_u64` and `get_id_instance` are never used
--> src/util.rs:88:12
|
83 | impl SpanId {
| ----------- methods in this implementation
...
88 | pub fn into_u64(self) -> u64 {
| ^^^^^^^^
...
92 | pub fn get_id_instance(&self) -> (NonZeroU32, u32) {
| ^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
Check warning on line 29 in src/profiler/thread/store.rs
github-actions / clippy
unused import: `bytesutil::WriteExt`
warning: unused import: `bytesutil::WriteExt`
--> src/profiler/thread/store.rs:29:5
|
29 | use bytesutil::WriteExt;
| ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default