Skip to content

Commit

Permalink
Fix some clippy warnings (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel authored Jun 25, 2024
1 parent d92dc93 commit e1071d6
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,40 +109,34 @@ mod tests {

#[test]
fn test_encode_i32() {
let p = Payload::Int32(std::i32::MAX);
let p = Payload::Int32(i32::MAX);
let (t, v) = p.encode();
assert_eq!(t, nvtx_sys::PayloadType::NVTX_PAYLOAD_TYPE_INT32);
unsafe { assert!(matches!(v, nvtx_sys::PayloadValue { iValue: v } if v == std::i32::MAX)) };
unsafe { assert!(matches!(v, nvtx_sys::PayloadValue { iValue: v } if v == i32::MAX)) };
}

#[test]
fn test_encode_u32() {
let p = Payload::Uint32(std::u32::MAX);
let p = Payload::Uint32(u32::MAX);
let (t, v) = p.encode();
assert_eq!(t, nvtx_sys::PayloadType::NVTX_PAYLOAD_TYPE_UNSIGNED_INT32);
unsafe {
assert!(matches!(v, nvtx_sys::PayloadValue { uiValue: v } if v == std::u32::MAX))
};
unsafe { assert!(matches!(v, nvtx_sys::PayloadValue { uiValue: v } if v == u32::MAX)) };
}

#[test]
fn test_encode_i64() {
let p = Payload::Int64(std::i64::MAX);
let p = Payload::Int64(i64::MAX);
let (t, v) = p.encode();
assert_eq!(t, nvtx_sys::PayloadType::NVTX_PAYLOAD_TYPE_INT64);
unsafe {
assert!(matches!(v, nvtx_sys::PayloadValue { llValue: v } if v == std::i64::MAX))
};
unsafe { assert!(matches!(v, nvtx_sys::PayloadValue { llValue: v } if v == i64::MAX)) };
}

#[test]
fn test_encode_u64() {
let p = Payload::Uint64(std::u64::MAX);
let p = Payload::Uint64(u64::MAX);
let (t, v) = p.encode();
assert_eq!(t, nvtx_sys::PayloadType::NVTX_PAYLOAD_TYPE_UNSIGNED_INT64);
unsafe {
assert!(matches!(v, nvtx_sys::PayloadValue { ullValue: v } if v == std::u64::MAX))
};
unsafe { assert!(matches!(v, nvtx_sys::PayloadValue { ullValue: v } if v == u64::MAX)) };
}

#[test]
Expand Down

0 comments on commit e1071d6

Please sign in to comment.