]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #35598 - tshepang:needless-binding, r=steveklabnik
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)
committerGitHub <noreply@github.com>
Sun, 14 Aug 2016 17:29:50 +0000 (20:29 +0300)
string: remove needless binding

1  2 
src/libcollections/string.rs

index cbbc0ba77947a2fb3a8b46eeec93019ffe4b2c0a,50716d03ac470493e269b38198ce1837d23f2d74..788c838cd3fc8ddaf70ec34a6d862bdac2d2a591
@@@ -1152,7 -1152,7 +1152,7 @@@ impl String 
          self.vec.set_len(len + amt);
      }
  
 -    /// Inserts a string into this `String` at a byte position.
 +    /// Inserts a string slice into this `String` at a byte position.
      ///
      /// This is an `O(n)` operation as it requires copying every element in the
      /// buffer.
      #[inline]
      #[unstable(feature = "insert_str",
                 reason = "recent addition",
 -               issue = "0")]
 +               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 {