summaryrefslogtreecommitdiff
path: root/rust/regex-rs/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/regex-rs/src/lib.rs')
-rw-r--r--rust/regex-rs/src/lib.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/rust/regex-rs/src/lib.rs b/rust/regex-rs/src/lib.rs
index f6e30edd..50ca9cfe 100644
--- a/rust/regex-rs/src/lib.rs
+++ b/rust/regex-rs/src/lib.rs
@@ -117,9 +117,7 @@ unsafe fn regex_error_to_str(errcode: libc::c_int, regex: &regex_t) -> Option<St
let errmsg_length = regerror(errcode, regex, ptr::null_mut(), 0);
// Allocate the buffer and get the message.
- // Casting u64 to usize is safe since the error message is unlikely to hit usize's
- // upper bound.
- let mut errmsg: Vec<u8> = vec![0; errmsg_length as usize];
+ let mut errmsg: Vec<u8> = vec![0; errmsg_length];
// Casting `*mut u8` to `*mut c_char` should be safe since C doesn't really care:
// it can store any ASCII symbol in a `char`, disregarding signedness.
regerror(