Skip to content

Commit 50c4b7e

Browse files
Merge pull request #168 from neherlab/chore/upgrade-rust
2 parents c63d058 + fb2153e commit 50c4b7e

File tree

21 files changed

+38
-48
lines changed

21 files changed

+38
-48
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ indicatif-log-bridge = "0.2.3"
6161
indoc = "=2.0.5"
6262
intervallum = "=1.4.1"
6363
itertools = "=0.14.0"
64-
lazy_static = "=1.5.0"
6564
log = "=0.4.26"
6665
maplit = "=1.0.2"
6766
ndarray = { version = "=0.16.1", features = ["rayon", "serde", "blas", "approx"] }
@@ -234,6 +233,7 @@ pub_use = "allow"
234233
pub_with_shorthand = "allow"
235234
question_mark_used = "allow"
236235
redundant_closure_for_method_calls = "allow"
236+
redundant_test_prefix = "allow"
237237
renamed_function_params = "allow"
238238
self_named_module_files = "allow"
239239
semicolon_inside_block = "allow"

packages/minimap2/src/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl Minimap2RawRegs {
387387

388388
// SAFETY: calling unsafe function. The `mm_map()` allocates memory for results array and the `.p` field each of
389389
// its elements' using `malloc()`. This memory needs to be deallocated using `free()`.
390-
let regs: *mut mm_reg1_t = unsafe { mm_map(mi, l_seq, seq, &mut n_regs, buf.get_mut(), map_opt, name) };
390+
let regs: *mut mm_reg1_t = unsafe { mm_map(mi, l_seq, seq, &raw mut n_regs, buf.get_mut(), map_opt, name) };
391391

392392
Ok(Self {
393393
regs,

packages/minimap2/src/options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ impl Minimap2Options {
6969
}
7070

7171
pub(crate) fn idx_opt_mut(&mut self) -> *mut mm_idxopt_t {
72-
&mut self.idx_opt
72+
&raw mut self.idx_opt
7373
}
7474

7575
pub(crate) fn map_opt(&self) -> &mm_mapopt_t {
7676
&self.map_opt
7777
}
7878

7979
pub(crate) fn map_opt_mut(&mut self) -> *mut mm_mapopt_t {
80-
&mut self.map_opt
80+
&raw mut self.map_opt
8181
}
8282
}
8383

packages/pangraph/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ indicatif-log-bridge = { workspace = true }
4343
indoc = { workspace = true }
4444
intervallum = { workspace = true }
4545
itertools = { workspace = true }
46-
lazy_static = { workspace = true }
4746
log = { workspace = true }
4847
maplit = { workspace = true }
4948
minimap2 = { workspace = true }

packages/pangraph/src/align/nextclade/align/seed_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn create_alignment_band(
115115

116116
// loop over remaining seeds in chain
117117
for next_seed in chain.iter().skip(1) {
118-
let mean_offset = (next_seed.offset + current_seed.offset) / 2; // offset of gap seed
118+
let mean_offset = isize::midpoint(next_seed.offset, current_seed.offset); // offset of gap seed
119119
let shift = abs_shift(current_seed, next_seed) / 2; // distance from mean offset
120120
look_forward_length = shift + excess_bandwidth;
121121

packages/pangraph/src/align/nextclade/align_with_nextclade.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ mod tests {
8181
use crate::commands::build::build_args::PangraphBuildArgs;
8282
use crate::o;
8383
use eyre::Report;
84-
use lazy_static::lazy_static;
8584
use pretty_assertions::assert_eq;
8685
use rstest::rstest;
86+
use std::sync::LazyLock;
8787

88-
lazy_static! {
89-
static ref EXTRA_BANDWIDTH: usize = PangraphBuildArgs::default().extra_band_width;
90-
}
88+
static EXTRA_BANDWIDTH: LazyLock<usize> = LazyLock::new(|| PangraphBuildArgs::default().extra_band_width);
9189

9290
#[rstest]
9391
fn test_align_with_nextclade_general_case() -> Result<(), Report> {

packages/pangraph/src/circularize/merge_blocks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ fn check_sequence_reconstruction(
178178
if seq != new_seq {
179179
warn!("seq1: {}", e1.apply(block_1.consensus())?);
180180
warn!("cons1: {}", block_1.consensus());
181-
warn!("e1: {:?}", e1);
181+
warn!("e1: {e1:?}");
182182
warn!("seq2: {}", e2.apply(block_2.consensus())?);
183183
warn!("cons2: {}", block_2.consensus());
184-
warn!("e2: {:?}", e2);
184+
warn!("e2: {e2:?}");
185185

186-
warn!("new_seq: {}", new_seq);
186+
warn!("new_seq: {new_seq}");
187187
warn!("new_cons: {}", new_block.consensus());
188-
warn!("new_e: {:?}", new_e);
188+
warn!("new_e: {new_e:?}");
189189
}
190190
debug_assert_eq!(seq, new_seq);
191191
}

packages/pangraph/src/commands/root_args.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
1212
use clap_complete::{Shell, generate};
1313
use clap_complete_fig::Fig;
1414
use eyre::{Report, eyre};
15-
use lazy_static::lazy_static;
1615
use num_cpus;
1716
use std::fmt::Debug;
1817
use std::io;
1918

20-
lazy_static! {
21-
pub static ref SHELLS: Vec<&'static str> = ["bash", "elvish", "fish", "fig", "powershell", "zsh"].to_vec();
22-
}
19+
const SHELLS: &[&str] = &["bash", "elvish", "fish", "fig", "powershell", "zsh"];
2320

2421
fn styles() -> styling::Styles {
2522
styling::Styles::styled()
@@ -90,7 +87,7 @@ pub enum PangraphCommands {
9087
///
9188
Completions {
9289
/// Name of the shell to generate appropriate completions
93-
#[clap(value_name = "SHELL", default_value_t = String::from("bash"), value_parser = SHELLS.clone())]
90+
#[clap(value_name = "SHELL", default_value_t = String::from("bash"), value_parser = SHELLS.to_vec())]
9491
shell: String,
9592
},
9693

packages/pangraph/src/io/compression.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use flate2::write::GzEncoder;
88
use num::Integer;
99
use num_traits::NumCast;
1010
use std::env;
11-
use std::io::{ErrorKind, Read, Write};
11+
use std::io::{Read, Write};
1212
use std::path::Path;
1313
use std::str::FromStr;
1414

@@ -123,7 +123,7 @@ impl Read for Decompressor<'_> {
123123
.header("Filename")
124124
})
125125
.with_section(|| self.compression_type.clone().header("Decompressor"))
126-
.map_err(|report| std::io::Error::new(ErrorKind::Other, report_to_string(&report)))
126+
.map_err(|report| std::io::Error::other(report_to_string(&report)))
127127
}
128128
}
129129

@@ -182,7 +182,7 @@ impl Write for Compressor<'_> {
182182
.header("Filename")
183183
})
184184
.with_section(|| self.compression_type.clone().header("Compressor"))
185-
.map_err(|report| std::io::Error::new(ErrorKind::Other, report_to_string(&report)))
185+
.map_err(|report| std::io::Error::other(report_to_string(&report)))
186186
}
187187

188188
fn flush(&mut self) -> std::io::Result<()> {
@@ -198,7 +198,7 @@ impl Write for Compressor<'_> {
198198
.header("Filename")
199199
})
200200
.with_section(|| self.compression_type.clone().header("Compressor"))
201-
.map_err(|report| std::io::Error::new(ErrorKind::Other, report_to_string(&report)))
201+
.map_err(|report| std::io::Error::other(report_to_string(&report)))
202202
}
203203
}
204204

0 commit comments

Comments
 (0)