summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel McCarney <daniel@binaryparadox.net>2024-09-09 16:40:33 -0400
committerDaniel McCarney <daniel@binaryparadox.net>2024-09-10 08:09:21 -0400
commit781cadb424e2aa77770c4021c707f5be3cd9e1f1 (patch)
treebc8d7cf8ea67946da90043804b4e2887e6628eee
parente084c94e130f77b1c91d24c5e3cbb252e51c1d51 (diff)
lib: remove usize cast from `try_slice!`
Prevent unsafety from using with incorrect argument type. Assume `$count` is already a `usize` and let the compiler err otherwise.
-rw-r--r--src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 53f48a8..be565a7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -672,7 +672,7 @@ macro_rules! try_slice {
if $ptr.is_null() {
return $crate::panic::NullParameterOrDefault::value();
} else {
- unsafe { slice::from_raw_parts($ptr, $count as usize) }
+ unsafe { slice::from_raw_parts($ptr, $count) }
}
};
}