refactor: improved readability for read orientation inference #833
clippy
48 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 48 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.81.0 (eeb90cda1 2024-09-04)
- cargo 1.81.0 (2dbb1af80 2024-08-20)
- clippy 0.1.81 (eeb90cd 2024-09-04)
Annotations
Check warning on line 140 in src/bam/record.rs
github-actions / clippy
the type `hts_sys::bam1_t` does not permit being left uninitialized
warning: the type `hts_sys::bam1_t` does not permit being left uninitialized
--> src/bam/record.rs:140:42
|
140 | let mut inner = unsafe { MaybeUninit::uninit().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
= note: integers must be initialized
= note: `#[warn(invalid_value)]` on by default
Check warning on line 33 in src/tpool.rs
github-actions / clippy
usage of an `Arc` that is not `Send` and `Sync`
warning: usage of an `Arc` that is not `Send` and `Sync`
--> src/tpool.rs:33:26
|
33 | let handle = Arc::new(RefCell::new(inner));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `Arc<RefCell<InnerThreadPool>>` is not `Send` and `Sync` as `RefCell<InnerThreadPool>` is neither `Send` nor `Sync`
= help: if the `Arc` will not used be across threads replace it with an `Rc`
= help: otherwise make `RefCell<InnerThreadPool>` `Send` and `Sync` or consider a wrapper type such as `Mutex`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
= note: `#[warn(clippy::arc_with_non_send_sync)]` on by default
Check warning on line 92 in src/faidx/mod.rs
github-actions / clippy
usage of a legacy numeric constant
warning: usage of a legacy numeric constant
--> src/faidx/mod.rs:92:18
|
92 | if end > std::i64::MAX as usize {
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
help: use the associated constant instead
|
92 | if end > i64::MAX as usize {
| ~~~~~~~~
Check warning on line 89 in src/faidx/mod.rs
github-actions / clippy
usage of a legacy numeric constant
warning: usage of a legacy numeric constant
--> src/faidx/mod.rs:89:20
|
89 | if begin > std::i64::MAX as usize {
| ^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
help: use the associated constant instead
|
89 | if begin > i64::MAX as usize {
| ~~~~~~~~
Check warning on line 231 in src/bgzf/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bgzf/mod.rs:231:9
|
231 | return Ok(ffi::CString::new(write_string).unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
231 - return Ok(ffi::CString::new(write_string).unwrap());
231 + Ok(ffi::CString::new(write_string).unwrap())
|
Check warning on line 324 in src/bcf/mod.rs
github-actions / clippy
doc list item without indentation
warning: doc list item without indentation
--> src/bcf/mod.rs:324:9
|
324 | /// is given, records are fetched from `start` until the end of the contig.
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
help: indent this line
|
324 | /// is given, records are fetched from `start` until the end of the contig.
| ++
Check warning on line 1471 in src/bcf/record.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/bcf/record.rs:1471:22
|
1471 | .map(|s| trim_slice(s))
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `trim_slice`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Check warning on line 1448 in src/bcf/record.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> src/bcf/record.rs:1448:22
|
1448 | .map(|s| trim_slice(s))
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `trim_slice`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
Check warning on line 1329 in src/bcf/record.rs
github-actions / clippy
very complex type used. Consider factoring parts into `type` definitions
warning: very complex type used. Consider factoring parts into `type` definitions
--> src/bcf/record.rs:1329:32
|
1329 | pub fn string(mut self) -> Result<Option<BufferBacked<'b, Vec<&'b [u8]>, B>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `#[warn(clippy::type_complexity)]` on by default
Check warning on line 1196 in src/bcf/record.rs
github-actions / clippy
dereferencing a tuple pattern where every element takes a reference
warning: dereferencing a tuple pattern where every element takes a reference
--> src/bcf/record.rs:1196:13
|
1196 | let &Genotype(ref alleles) = self;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
= note: `#[warn(clippy::needless_borrowed_reference)]` on by default
help: try removing the `&` and `ref` parts
|
1196 - let &Genotype(ref alleles) = self;
1196 + let Genotype(alleles) = self;
|
Check warning on line 1097 in src/bcf/record.rs
github-actions / clippy
returning the result of a `let` binding from a block
warning: returning the result of a `let` binding from a block
--> src/bcf/record.rs:1097:13
|
1096 | let inner = htslib::bcf_dup(self.inner);
| ---------------------------------------- unnecessary `let` binding
1097 | inner
| ^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
1096 ~
1097 ~ htslib::bcf_dup(self.inner)
|
Check warning on line 126 in src/bcf/record.rs
github-actions / clippy
casting raw pointers to the same type and constness is unnecessary (`*mut libc::c_void` -> `*mut libc::c_void`)
warning: casting raw pointers to the same type and constness is unnecessary (`*mut libc::c_void` -> `*mut libc::c_void`)
--> src/bcf/record.rs:126:26
|
126 | ::libc::free(self.inner as *mut ::libc::c_void);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.inner`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 120 in src/bcf/record.rs
github-actions / clippy
you should consider adding a `Default` implementation for `Buffer`
warning: you should consider adding a `Default` implementation for `Buffer`
--> src/bcf/record.rs:115:5
|
115 | / pub fn new() -> Self {
116 | | Buffer {
117 | | inner: ptr::null_mut(),
118 | | len: 0,
119 | | }
120 | | }
| |_____^
|
= 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
|
114 + impl Default for Buffer {
115 + fn default() -> Self {
116 + Self::new()
117 + }
118 + }
|
Check warning on line 10 in src/bcf/record.rs
github-actions / clippy
importing legacy numeric constants
warning: importing legacy numeric constants
--> src/bcf/record.rs:10:5
|
10 | use std::i32;
| ^^^^^^^^
|
= help: remove this import
= note: then `i32::<CONST>` will resolve to the respective associated constant
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants
Check warning on line 120 in src/bcf/header.rs
github-actions / clippy
casting raw pointers to the same type and constness is unnecessary (`*mut i32` -> `*mut i32`)
warning: casting raw pointers to the same type and constness is unnecessary (`*mut i32` -> `*mut i32`)
--> src/bcf/header.rs:120:17
|
120 | imap.as_mut_ptr() as *mut i32,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `imap.as_mut_ptr()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 119 in src/bcf/header.rs
github-actions / clippy
casting raw pointers to the same type and constness is unnecessary (`*const *mut i8` -> `*const *mut i8`)
warning: casting raw pointers to the same type and constness is unnecessary (`*const *mut i8` -> `*const *mut i8`)
--> src/bcf/header.rs:119:17
|
119 | name_pointers.as_ptr() as *const *mut c_char,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `name_pointers.as_ptr()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 1291 in src/bam/mod.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/bam/mod.rs:1291:32
|
1291 | match self.reader.read(&mut record) {
| ^^^^^^^^^^^ help: change this to: `record`
|
= 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 1125 in src/bam/mod.rs
github-actions / clippy
casting to the same type is unnecessary (`usize` -> `usize`)
warning: casting to the same type is unnecessary (`usize` -> `usize`)
--> src/bam/mod.rs:1125:17
|
1125 | ((l_text + 1) as usize).try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(l_text + 1)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
Check warning on line 1125 in src/bam/mod.rs
github-actions / clippy
useless conversion to the same type: `usize`
warning: useless conversion to the same type: `usize`
--> src/bam/mod.rs:1125:17
|
1125 | ((l_text + 1) as usize).try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider removing `.try_into()`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
Check warning on line 325 in src/bam/mod.rs
github-actions / clippy
doc list item without indentation
warning: doc list item without indentation
--> src/bam/mod.rs:325:9
|
325 | /// a valid virtual offset.
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
= note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
|
325 | /// a valid virtual offset.
| ++
Check warning on line 2466 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2466:9
|
2466 | return Some(Ok(data));
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
2466 - return Some(Ok(data));
2466 + Some(Ok(data))
|
Check warning on line 2432 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2432:9
|
2432 | return self.mod_state.query_type(code);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
2432 - return self.mod_state.query_type(code);
2432 + self.mod_state.query_type(code)
|
Check warning on line 2431 in src/bam/record.rs
github-actions / clippy
this lifetime isn't used in the function definition
warning: this lifetime isn't used in the function definition
--> src/bam/record.rs:2431:23
|
2431 | pub fn query_type<'a>(&self, code: i32) -> Result<BaseModificationMetadata> {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
Check warning on line 2419 in src/bam/record.rs
github-actions / clippy
the following explicit lifetimes could be elided: 'a
warning: the following explicit lifetimes could be elided: 'a
--> src/bam/record.rs:2419:12
|
2419 | fn new<'a>(r: &'a Record) -> Result<BaseModificationsIter<'a>> {
| ^^ ^^ ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
2419 - fn new<'a>(r: &'a Record) -> Result<BaseModificationsIter<'a>> {
2419 + fn new(r: &Record) -> Result<BaseModificationsIter<'_>> {
|
Check warning on line 2406 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2406:23
|
2406 | Err(e) => return Some(Err(e)),
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
|
2406 | Err(e) => Some(Err(e)),
| ~~~~~~~~~~~~