This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
feat: allow parsing single ended RA files #410
Annotations
9 errors and 1 warning
this `else { if .. }` block can be collapsed:
src/read_pair_iter.rs#L329
error: this `else { if .. }` block can be collapsed
--> src/read_pair_iter.rs:329:16
|
329 | } else {
| ________________^
330 | | if let Some(p) = self.iters.paths[0].as_ref() {
331 | | let rdr = Self::open_fastq_confirm_fmt(p)?;
332 | | let parser = fastq::Parser::new(rdr);
... |
360 | | }
361 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
note: the lint level is defined here
--> src/lib.rs:12:9
|
12 | #![deny(warnings, unused)]
| ^^^^^^^^
= note: `#[deny(clippy::collapsible_else_if)]` implied by `#[deny(warnings)]`
help: collapse nested if block
|
329 ~ } else if let Some(p) = self.iters.paths[0].as_ref() {
330 + let rdr = Self::open_fastq_confirm_fmt(p)?;
331 + let parser = fastq::Parser::new(rdr);
332 + let mut r1_iter = parser.ref_iter();
333 + r1_iter
334 + .advance()
335 + .map_err(|e| FastqError::format(format!("Ran into trouble while getting first RA read to check if fastq was single ended.\n {:?}", e.to_string()), p, 0))?;
336 + let first_read_header = r1_iter
337 + .get()
338 + .map(|x| {
339 + x.head()
340 + .to_owned()
341 + .split(|x| *x == b' ' || *x == b'/')
342 + .next()
343 + .map(|x| x.to_owned())
344 + })
345 + .flatten();
346 + r1_iter.advance().map_err(|e| FastqError::format(format!("Ran into trouble while getting second RA read to check if fastq was single ended.\n {:?}", e.to_string()), p, 4))?;
347 + let second_read_header = r1_iter
348 + .get()
349 + .map(|x| {
350 + x.head()
351 + .split(|x| *x == b' ' || *x == b'/')
352 + .next()
353 + .map(|x| x.to_owned())
354 + })
355 + .flatten();
356 + Ok(first_read_header != second_read_header)
357 + } else {
358 + Ok(false)
359 + }
|
|
this `else { if .. }` block can be collapsed:
src/read_pair_iter.rs#L487
error: this `else { if .. }` block can be collapsed
--> src/read_pair_iter.rs:487:32
|
487 | } else {
| ________________________________^
488 | | if let Some(current_read_record) = current_read_record {
489 | | let read_length = read_lengths[WhichRead::R2 as usize];
490 | | let fake_r2_read = OwnedRecord {
... |
498 | | }
499 | | }
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
help: collapse nested if block
|
487 ~ } else if let Some(current_read_record) = current_read_record {
488 + let read_length = read_lengths[WhichRead::R2 as usize];
489 + let fake_r2_read = OwnedRecord {
490 + head: current_read_record.head().to_owned(),
491 + sep: Some(current_read_record.seq().to_owned()),
492 + seq: vec![],
493 + qual: vec![],
494 + };
495 + let tr = TrimRecord::new(&fake_r2_read, read_length);
496 + rp.push_read(&tr, WhichRead::R2)
497 + }
|
|
called `map(..).flatten()` on `Option`:
src/read_pair_iter.rs#L339
error: called `map(..).flatten()` on `Option`
--> src/read_pair_iter.rs:339:22
|
339 | .map(|x| {
| ______________________^
340 | | x.head()
341 | | .to_owned()
342 | | .split(|x| *x == b' ' || *x == b'/')
... |
345 | | })
346 | | .flatten();
| |______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
= note: `#[deny(clippy::map_flatten)]` implied by `#[deny(warnings)]`
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
339 ~ .and_then(|x| {
340 + x.head()
341 + .to_owned()
342 + .split(|x| *x == b' ' || *x == b'/')
343 + .next()
344 + .map(|x| x.to_owned())
345 ~ });
|
|
redundant closure:
src/read_pair_iter.rs#L344
error: redundant closure
--> src/read_pair_iter.rs:344:34
|
344 | ... .map(|x| x.to_owned())
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::borrow::ToOwned::to_owned`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
= note: `#[deny(clippy::redundant_closure_for_method_calls)]` implied by `#[deny(warnings)]`
|
called `map(..).flatten()` on `Option`:
src/read_pair_iter.rs#L350
error: called `map(..).flatten()` on `Option`
--> src/read_pair_iter.rs:350:22
|
350 | .map(|x| {
| ______________________^
351 | | x.head()
352 | | .split(|x| *x == b' ' || *x == b'/')
353 | | .next()
354 | | .map(|x| x.to_owned())
355 | | })
356 | | .flatten();
| |______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
help: try replacing `map` with `and_then` and remove the `.flatten()`
|
350 ~ .and_then(|x| {
351 + x.head()
352 + .split(|x| *x == b' ' || *x == b'/')
353 + .next()
354 + .map(|x| x.to_owned())
355 ~ });
|
|
redundant closure:
src/read_pair_iter.rs#L354
error: redundant closure
--> src/read_pair_iter.rs:354:34
|
354 | ... .map(|x| x.to_owned())
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::borrow::ToOwned::to_owned`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
|
used `assert_eq!` with a literal bool:
src/read_pair_iter.rs#L641
error: used `assert_eq!` with a literal bool
--> src/read_pair_iter.rs:641:9
|
641 | / assert_eq!(
642 | | false,
643 | | it.is_single_ended()
644 | | .expect("Ran into trouble checking if read was single ended")
645 | | );
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
= note: `#[deny(clippy::bool_assert_comparison)]` implied by `#[deny(warnings)]`
help: replace it with `assert!(..)`
|
641 ~ assert!(
642 ~ !it.is_single_ended()
643 + .expect("Ran into trouble checking if read was single ended")
|
|
used `assert_eq!` with a literal bool:
src/read_pair_iter.rs#L663
error: used `assert_eq!` with a literal bool
--> src/read_pair_iter.rs:663:9
|
663 | / assert_eq!(
664 | | true,
665 | | it.is_single_ended()
666 | | .expect("Ran into trouble checking if read was single ended")
667 | | );
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
help: replace it with `assert!(..)`
|
663 ~ assert!(
664 ~ it.is_single_ended()
|
|
test
Clippy had exited with the 101 exit code
|
test
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: 10XGenomics/clippy-check@main. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|