]> git.lizzy.rs Git - rust.git/blobdiff - src/libcollections/string.rs
Rollup merge of #35598 - tshepang:needless-binding, r=steveklabnik
[rust.git] / src / libcollections / string.rs
index cbbc0ba77947a2fb3a8b46eeec93019ffe4b2c0a..788c838cd3fc8ddaf70ec34a6d862bdac2d2a591 100644 (file)
@@ -1182,8 +1182,7 @@ unsafe fn insert_bytes(&mut self, idx: usize, bytes: &[u8]) {
                reason = "recent addition",
                issue = "35553")]
     pub fn insert_str(&mut self, idx: usize, string: &str) {
-        let len = self.len();
-        assert!(idx <= len);
+        assert!(idx <= self.len());
         assert!(self.is_char_boundary(idx));
 
         unsafe {