about summary refs log tree commit diff
path: root/library/alloc/tests/string.rs
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-09-08 21:39:13 +0200
committerMara Bos <m-ou.se@m-ou.se>2020-09-19 06:54:42 +0200
commit1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102 (patch)
tree402ea425d8883c2c501f563220fddf001d0f91c2 /library/alloc/tests/string.rs
parent5c30a16fa03efaf87241b363f4323743746c12b0 (diff)
downloadrust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.tar.gz
rust-1e2dba1e7cf15442257f2cd3ddfe5d0462ee9102.zip
Use `T::BITS` instead of `size_of::<T> * 8`.
Diffstat (limited to 'library/alloc/tests/string.rs')
-rw-r--r--library/alloc/tests/string.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/library/alloc/tests/string.rs b/library/alloc/tests/string.rs
index 4e604354122..a6e41b21b61 100644
--- a/library/alloc/tests/string.rs
+++ b/library/alloc/tests/string.rs
@@ -1,6 +1,5 @@
 use std::borrow::Cow;
 use std::collections::TryReserveError::*;
-use std::mem::size_of;
 use std::ops::Bound::*;
 
 pub trait IntoCow<'a, B: ?Sized>
@@ -605,7 +604,7 @@ fn test_try_reserve() {
     // on 64-bit, we assume the OS will give an OOM for such a ridiculous size.
     // Any platform that succeeds for these requests is technically broken with
     // ptr::offset because LLVM is the worst.
-    let guards_against_isize = size_of::<usize>() < 8;
+    let guards_against_isize = usize::BITS < 64;
 
     {
         // Note: basic stuff is checked by test_reserve
@@ -686,7 +685,7 @@ fn test_try_reserve_exact() {
     const MAX_CAP: usize = isize::MAX as usize;
     const MAX_USIZE: usize = usize::MAX;
 
-    let guards_against_isize = size_of::<usize>() < 8;
+    let guards_against_isize = usize::BITS < 64;
 
     {
         let mut empty_string: String = String::new();