rust: fix test type errors
- Commit
54d186dc56c850578953e8f044d3e613b460ffec- Author
- vayun-mathur <[email protected]>
- When
- 2026-10-22 00:21 UTC (1 month ago)
- Parents
d02b36a
Diff
games/voxels/src/main/rust/tests/world_edges.rs
diff --git a/games/voxels/src/main/rust/tests/world_edges.rs b/games/voxels/src/main/rust/tests/world_edges.rsindex 7c05e77e95..cabbcabf97 100644--- a/games/voxels/src/main/rust/tests/world_edges.rs+++ b/games/voxels/src/main/rust/tests/world_edges.rs@@ -124,7 +124,7 @@ fn inventory_hotbar_rules_hold() { assert_eq!(inv.selected_block(), Block::Stone as u16); assert_eq!(inv.consume_selected(), Some(Block::Stone as u16)); assert_eq!(inv.consume_selected(), None, "slot drained after one consume");- for _ in 0..(SLOTS * STACK + 10) {+ for _ in 0..(SLOTS as i32 * STACK + 10) { inv.try_add_block(Block::Dirt as u16); } let total = inv.count_of(Block::Dirt as u16);
library/ml/src/main/rust/tests/pure_logic.rs
diff --git a/library/ml/src/main/rust/tests/pure_logic.rs b/library/ml/src/main/rust/tests/pure_logic.rsindex 7bc306aaa0..d3e8a09919 100644--- a/library/ml/src/main/rust/tests/pure_logic.rs+++ b/library/ml/src/main/rust/tests/pure_logic.rs@@ -169,18 +169,20 @@ fn sentencepiece_tables_reject_malformed_bytes_before_decoding() { assert_eq!(table.decode(&[]), ""); assert_eq!(table.decode(&[999]), ""); // Not a table at all, a header cut short, and a table with bytes trailing it.- let error = Table::parse(&[]).expect_err("empty");+ // (Table carries no Debug so expect_err is unavailable; the error side is+ // a plain String, so unwrap_err works.)+ let error = Table::parse(&[]).unwrap_err(); assert!(error.contains("SPM1"), "{error}");- let error = Table::parse(b"BAD!").expect_err("bad magic");+ let error = Table::parse(b"BAD!").unwrap_err(); assert!(error.contains("SPM1"), "{error}"); let cut = bytes.get(..10).unwrap_or(&[]).to_vec(); assert!(Table::parse(&cut).is_err()); let mut trailing = bytes.clone(); trailing.push(0);- let error = Table::parse(&trailing).expect_err("trailing byte");+ let error = Table::parse(&trailing).unwrap_err(); assert!(error.contains("bytes left"), "{error}"); // The same bytes under the wrong convention are refused: id 0 is `<s>`, not `<pad>`.- let error = Table::parse_with(&bytes, GEMMA).expect_err("wrong flavour");+ let error = Table::parse_with(&bytes, GEMMA).unwrap_err(); assert!(error.contains("not <pad>"), "{error}"); // The flavour travelled with the parse, so callers read back what they asked for. assert_eq!(table.specials(), FAIRSEQ);
web/src/main/rust/tests/shields.rs
diff --git a/web/src/main/rust/tests/shields.rs b/web/src/main/rust/tests/shields.rsindex ecc66d1256..99119d60cc 100644--- a/web/src/main/rust/tests/shields.rs+++ b/web/src/main/rust/tests/shields.rs@@ -99,8 +99,11 @@ fn cosmetic_filter_yields_hide_selector() { #[test] fn generic_cosmetic_rule_matches_an_observed_class() { let engine = engine_with("##.promo");- let selectors =- engine.hidden_class_id_selectors(vec!["promo".to_string()], Vec::new(), &HashSet::new());+ let selectors = engine.hidden_class_id_selectors(+ vec!["promo".to_string()],+ Vec::<String>::new(),+ &HashSet::new(),+ ); assert!(selectors.iter().any(|s| s.contains("promo"))); }