diff options
| author | bors <bors@rust-lang.org> | 2016-12-07 03:54:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-07 03:54:14 +0000 |
| commit | 02ea82ddb8315249067afb2f800d62b4ca1f7678 (patch) | |
| tree | 81198184fe59f8e519a587ad986fb5241b953f14 | |
| parent | 3fef221514ab31088f75d14516c851e68a70cf9e (diff) | |
| parent | 4dd590ac8c93e99c946aee28def4662b9c6b5865 (diff) | |
| download | rust-02ea82ddb8315249067afb2f800d62b4ca1f7678.tar.gz rust-02ea82ddb8315249067afb2f800d62b4ca1f7678.zip | |
Auto merge of #38144 - clarcharr:redundant, r=alexcrichton
Remove redundant assertion near is_char_boundary Follow-up from #38056. `is_char_boundary` already checks for `idx <= len`, so, an extra assertion is redundant.
| -rw-r--r-- | src/libcollections/string.rs | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index ddde9d06d81..fff7c160e31 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1129,8 +1129,6 @@ impl String { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn insert(&mut self, idx: usize, ch: char) { - let len = self.len(); - assert!(idx <= len); assert!(self.is_char_boundary(idx)); let mut bits = [0; 4]; let bits = ch.encode_utf8(&mut bits).as_bytes(); @@ -1184,7 +1182,6 @@ impl String { reason = "recent addition", issue = "35553")] pub fn insert_str(&mut self, idx: usize, string: &str) { - assert!(idx <= self.len()); assert!(self.is_char_boundary(idx)); unsafe { @@ -1288,7 +1285,6 @@ impl String { #[unstable(feature = "string_split_off", issue = "38080")] pub fn split_off(&mut self, mid: usize) -> String { assert!(self.is_char_boundary(mid)); - assert!(mid <= self.len()); let other = self.vec.split_off(mid); unsafe { String::from_utf8_unchecked(other) } } |
