Skip to content

Commit 2ad6d36

Browse files
authored
Fix Clippy warnings for Rust 1.92 (#1435)
Clippy warned "this assertion has a constant value" in a `debug_assert`. We replaced the `cfg!` expression with the `#[cfg]` attribute. Clippy treated a tuple constructor as double parenthesis by mistake. We extracted the tuple constructor into an explicit let-binding.
1 parent d2253be commit 2ad6d36

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/util/alloc/free_list_allocator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ impl<VM: VMBinding> FreeListAllocator<VM> {
422422
let unswept = self.unswept_blocks.get_mut(bin).unwrap();
423423

424424
// If we do eager sweeping, we should have no unswept blocks.
425-
debug_assert!(!cfg!(feature = "eager_sweeping") || unswept.is_empty());
425+
#[cfg(feature = "eager_sweeping")]
426+
debug_assert!(unswept.is_empty());
426427

427428
let mut sweep_later = |list: &mut BlockList| {
428429
list.release_blocks(self.space);

src/util/test_util/mock_vm.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,19 @@ macro_rules! lifetime {
5656
/// Call `MockMethod`.
5757
macro_rules! mock {
5858
($fn: ident($($arg:expr),*)) => {
59-
write_mockvm(|mock| mock.$fn.call(($($arg),*)))
59+
{
60+
let arg_tuple = ($($arg),*);
61+
write_mockvm(|mock| mock.$fn.call(arg_tuple))
62+
}
6063
};
6164
}
6265
/// Call `MockAny`.
6366
macro_rules! mock_any {
6467
($fn: ident($($arg:expr),*)) => {
65-
*write_mockvm(|mock| mock.$fn.call_any(Box::new(($($arg),*)))).downcast().unwrap()
68+
{
69+
let arg_tuple = ($($arg),*);
70+
*write_mockvm(|mock| mock.$fn.call_any(Box::new(arg_tuple))).downcast().unwrap()
71+
}
6672
};
6773
}
6874

0 commit comments

Comments
 (0)