Skip to content

Commit 164e3b9

Browse files
committed
chore: clear clippy backlog where mechanical, keep deliberate signaturesc
1 parent 3f43b53 commit 164e3b9

8 files changed

Lines changed: 10 additions & 11 deletions

File tree

crates/core/src/mel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ fn reflect_pad(signal: &[f32], pad_l: usize, pad_r: usize) -> Result<Vec<f32>> {
328328

329329
fn pad_sizes(win_length: usize, hop_length: usize) -> (usize, usize) {
330330
let diff = win_length - hop_length;
331-
(diff / 2, (diff + 1) / 2)
331+
(diff / 2, diff.div_ceil(2))
332332
}
333333

334334
#[cfg(test)]

crates/core/src/model/tests.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ fn joint_attention_mask_matches_region_rules() {
1616
let side = 6usize;
1717

1818
assert_eq!(mask.len(), side * side);
19-
assert_eq!(mask[0 * side + 1], 0.0);
20-
assert_eq!(mask[0 * side + 2], 0.0);
21-
assert_eq!(mask[0 * side + 4], -10_000.0);
19+
assert_eq!(mask[1], 0.0);
20+
assert_eq!(mask[2], 0.0);
21+
assert_eq!(mask[4], -10_000.0);
2222
assert_eq!(mask[2 * side + 3], 0.0);
2323
assert_eq!(mask[4 * side + 5], -10_000.0);
2424
assert_eq!(mask[5 * side + 5], -10_000.0);
@@ -278,7 +278,6 @@ fn fake_config() -> GameModelConfig {
278278
midi_std: 1.0,
279279
..Default::default()
280280
},
281-
..Default::default()
282281
}
283282
}
284283

crates/core/src/model/weights.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ fn validate_supported_config(cfg: &GameModelConfig) -> Result<()> {
981981
Ok(())
982982
}
983983

984-
fn layer_scale_name<'a>(enabled: bool, name: &'a str) -> Option<&'a str> {
984+
fn layer_scale_name(enabled: bool, name: &str) -> Option<&str> {
985985
enabled.then_some(name)
986986
}
987987

crates/core/src/notify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Notifier for NullNotifier {
5050
}
5151

5252
thread_local! {
53-
static CURRENT_NOTIFIER: RefCell<Vec<(usize, usize)>> = RefCell::new(Vec::new());
53+
static CURRENT_NOTIFIER: RefCell<Vec<(usize, usize)>> = const { RefCell::new(Vec::new()) };
5454
}
5555

5656
pub(crate) fn with_notifier<T>(notifier: &dyn Notifier, f: impl FnOnce() -> T) -> T {

crates/core/src/tensor/cpu/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub(super) fn suffix_broadcast_block_len(
147147
}
148148

149149
let rank_diff = out.len() - rhs.len();
150-
if out[..rank_diff].iter().any(|&dim| dim == 0) {
150+
if out[..rank_diff].contains(&0) {
151151
return None;
152152
}
153153
if out[rank_diff..] != rhs[..] {

crates/output/src/midi_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn encode_midi(notes: &[Note], options: &MidiWriteOptions) -> Result<Vec<u8>
8989
tick: last_tick,
9090
kind: TrackEventKind::Meta(MetaMessage::EndOfTrack),
9191
});
92-
events.sort_by(|left, right| left.tick.cmp(&right.tick));
92+
events.sort_by_key(|left| left.tick);
9393

9494
let mut prev_tick = 0u64;
9595
let mut track = Vec::with_capacity(events.len());

crates/service/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn get_chunk_semaphore() -> ChunkSemaphore {
7474
let max_concurrent = std::env::var("GAME_MAX_CONCURRENT_CHUNKS")
7575
.ok()
7676
.and_then(|s| s.parse::<usize>().ok())
77-
.unwrap_or_else(|| rayon::current_num_threads());
77+
.unwrap_or_else(rayon::current_num_threads);
7878
ChunkSemaphore::new(max_concurrent)
7979
})
8080
.clone()

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ fn inspect(
10431043
print_inspect_section("model_config");
10441044
print_inspect_kv("name", display_or_dash(&model.config.name));
10451045
print_inspect_kv("version", display_or_dash(&model.config.version));
1046-
print_inspect_kv("mode", model.config.mode.to_string());
1046+
print_inspect_kv("mode", &model.config.mode);
10471047
print_inspect_kv("embedding dim", model.config.embedding_dim.to_string());
10481048
print_inspect_kv("input dim", model.config.in_dim.to_string());
10491049
print_inspect_kv("estimator out", model.config.estimator_out_dim.to_string());

0 commit comments

Comments
 (0)