diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-09-09 15:05:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-09 15:05:56 -0700 |
| commit | 0d20cf8568114986c4ed8eddcb91c5a998383ad7 (patch) | |
| tree | 6914219de6cd3d5451d68ed0de34cc0b356388b7 | |
| parent | 09bfb7ea2b914074fa551fbe40b348115abfbf84 (diff) | |
| parent | e02952c0cc6b360ac914f97da1dfcc46fd82f92c (diff) | |
| download | rust-0d20cf8568114986c4ed8eddcb91c5a998383ad7.tar.gz rust-0d20cf8568114986c4ed8eddcb91c5a998383ad7.zip | |
Rollup merge of #76481 - moonheart08:vec_deque_constify, r=sfackler
Convert repetitive target_pointer_width checks to const solution. Simply a quick code tidying change. Not sure if more needs to be said.
| -rw-r--r-- | library/alloc/src/collections/vec_deque.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/library/alloc/src/collections/vec_deque.rs b/library/alloc/src/collections/vec_deque.rs index cc2ef25a5a7..f7f488f2f07 100644 --- a/library/alloc/src/collections/vec_deque.rs +++ b/library/alloc/src/collections/vec_deque.rs @@ -32,12 +32,8 @@ mod tests; const INITIAL_CAPACITY: usize = 7; // 2^3 - 1 const MINIMUM_CAPACITY: usize = 1; // 2 - 1 -#[cfg(target_pointer_width = "16")] -const MAXIMUM_ZST_CAPACITY: usize = 1 << (16 - 1); // Largest possible power of two -#[cfg(target_pointer_width = "32")] -const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two -#[cfg(target_pointer_width = "64")] -const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of two + +const MAXIMUM_ZST_CAPACITY: usize = 1 << (core::mem::size_of::<usize>() * 8 - 1); // Largest possible power of two /// A double-ended queue implemented with a growable ring buffer. /// |
