mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-31 08:33:51 +01:00
Simplify code with const assert!.
The code that prevents compilation on systems where usize is larger than u64 previously used a const index-out-of-bounds trick. That code can now be replaced with assert!, as const panic! has landed in 1.57.0 stable.
This commit is contained in:
@@ -81,14 +81,10 @@ impl<C, D> fmt::Debug for NewClient<C, D> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[allow(clippy::no_effect)]
|
||||
const CHECK_USIZE: () = {
|
||||
if std::mem::size_of::<usize>() > std::mem::size_of::<u64>() {
|
||||
// TODO: replace this with panic!() as soon as RFC 2345 gets stabilized
|
||||
["usize is too big to fit in u64"][42];
|
||||
}
|
||||
};
|
||||
const _CHECK_USIZE: () = assert!(
|
||||
std::mem::size_of::<usize>() <= std::mem::size_of::<u64>(),
|
||||
"usize is too big to fit in u64"
|
||||
);
|
||||
|
||||
/// Handles communication from the client to request dispatch.
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user