Skip to content

Commit

Permalink
chore: fix some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
tedil committed Jul 4, 2024
1 parent dbed863 commit 4becad7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
12 changes: 6 additions & 6 deletions src/data/cdot/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct Config {
/// The method are not implemented.
///
/// The method `get_tx_exons()` returns `None` for record entries `tx_aseq`, and `alt_aseq`
/// and `std::i32::MAX` for `tx_exon-set_id`, `alt_exon_set_id`, `tx_exon_id`, `alt_exon_id`,
/// and `i32::MAX` for `tx_exon-set_id`, `alt_exon_set_id`, `tx_exon_id`, `alt_exon_id`,
/// `exon_aln_id`.
pub struct Provider {
inner: TxProvider,
Expand Down Expand Up @@ -853,11 +853,11 @@ impl TxProvider {
cigar: exon.cigar.clone(),
tx_aseq: None,
alt_aseq: None,
tx_exon_set_id: std::i32::MAX,
alt_exon_set_id: std::i32::MAX,
tx_exon_id: std::i32::MAX,
alt_exon_id: std::i32::MAX,
exon_aln_id: std::i32::MAX,
tx_exon_set_id: i32::MAX,
alt_exon_set_id: i32::MAX,
tx_exon_id: i32::MAX,
alt_exon_id: i32::MAX,
exon_aln_id: i32::MAX,
})
.collect())
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/normalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ impl<'a> Normalizer<'a> {
.last()
.expect("should not happen; must have at least one exon"),
);
exon_ends.push(std::i32::MAX);
exon_ends.push(i32::MAX);

// Find the end pos of the exon where the var locates.
let _left = 0;
let _right = std::i32::MAX;
let _right = i32::MAX;

// NB: the following content is from the original Python code.
// TODO: #242: implement methods to find tx regions
Expand Down Expand Up @@ -357,7 +357,7 @@ impl<'a> Normalizer<'a> {
Ok(left..right)
} else {
// For variant types g., m., etc.
Ok(0..std::i32::MAX)
Ok(0..i32::MAX)
}
}

Expand Down Expand Up @@ -846,7 +846,7 @@ impl<'a> Normalizer<'a> {
var,
HgvsVariant::GenomeVariant { .. } | HgvsVariant::MtVariant { .. }
) {
std::i32::MAX
i32::MAX
} else {
let id_info = self.provider.get_tx_identity_info(var.accession())?;
id_info.lengths.into_iter().sum()
Expand Down
22 changes: 8 additions & 14 deletions src/parser/ds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,14 @@ impl HgvsVariant {
.try_into()
.ok()
.map(|l| Mu::from(l, loc_edit.loc.is_certain())),
HgvsVariant::TxVariant { loc_edit, .. } => loc_edit
.loc
.inner()
.clone()
.try_into()
.ok()
.map(|l| Mu::from(l, loc_edit.loc.is_certain())),
HgvsVariant::RnaVariant { loc_edit, .. } => loc_edit
.loc
.inner()
.clone()
.try_into()
.ok()
.map(|l| Mu::from(l, loc_edit.loc.is_certain())),
HgvsVariant::TxVariant { loc_edit, .. } => {
Some(From::from(loc_edit.loc.inner().clone()))
.map(|l| Mu::from(l, loc_edit.loc.is_certain()))
}
HgvsVariant::RnaVariant { loc_edit, .. } => {
Some(From::from(loc_edit.loc.inner().clone()))
.map(|l| Mu::from(l, loc_edit.loc.is_certain()))
}
HgvsVariant::ProtVariant {
loc_edit: ProtLocEdit::Ordinary { loc, .. },
..
Expand Down

0 comments on commit 4becad7

Please sign in to comment.