fix: use correct return value in bcf_get_format and bcf_get_info_valu… #746
clippy
30 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 30 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.70.0 (90c541806 2023-05-31)
- cargo 1.70.0 (ec8a8a0ca 2023-04-25)
- clippy 0.1.70 (90c5418 2023-05-31)
Annotations
Check warning on line 128 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:128:42
|
128 | 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 235 in src/bgzf/mod.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bgzf/mod.rs:235:9
|
235 | 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`
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 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 1289 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:1289:32
|
1289 | 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 1123 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:1123:17
|
1123 | ((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
= note: `#[warn(clippy::unnecessary_cast)]` on by default
Check warning on line 2447 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2447:9
|
2447 | return Some(Ok(data));
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2413 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2413:9
|
2413 | 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`
Check warning on line 2412 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:2412:23
|
2412 | 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 2400 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:2400:5
|
2400 | 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
|
2400 - fn new<'a>(r: &'a Record) -> Result<BaseModificationsIter<'a>> {
2400 + fn new(r: &Record) -> Result<BaseModificationsIter<'_>> {
|
Check warning on line 2387 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2387:23
|
2387 | 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`
Check warning on line 2384 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2384:21
|
2384 | return Some(Ok(data));
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2381 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2381:21
|
2381 | return None;
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2364 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2364:9
|
2364 | 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`
Check warning on line 2363 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:2363:23
|
2363 | 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 2354 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:2354:5
|
2354 | fn new<'a>(r: &'a Record) -> Result<BaseModificationsPositionIter<'a>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
|
2354 - fn new<'a>(r: &'a Record) -> Result<BaseModificationsPositionIter<'a>> {
2354 + fn new(r: &Record) -> Result<BaseModificationsPositionIter<'_>> {
|
Check warning on line 2333 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2329:17
|
2329 | / return Ok(BaseModificationMetadata {
2330 | | strand,
2331 | | implicit,
2332 | | canonical,
2333 | | });
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2327 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2327:17
|
2327 | return Err(Error::BamBaseModificationTypeNotFound);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2313 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:2313:23
|
2313 | 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
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
Check warning on line 2288 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2288:13
|
2288 | return Ok(ret as usize);
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 2260 in src/bam/record.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> src/bam/record.rs:2260:9
|
2260 | return Ok(bm);
| ^^^^^^^^^^^^^
|
= 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`