about summary refs log tree commit diff
path: root/src/liballoc/string.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-25 22:18:27 +0000
committerbors <bors@rust-lang.org>2018-05-25 22:18:27 +0000
commit07c415c2154f29d6dce8da0154ef41c8a5497fbf (patch)
tree28953c14cf6541f651c295f9815ae4c2aa5614d9 /src/liballoc/string.rs
parent990d8aa743b1dda3cc0f68fe09524486261812c6 (diff)
parentf7c4a33f32b8139778b8c6792b9e55c74770a234 (diff)
downloadrust-07c415c2154f29d6dce8da0154ef41c8a5497fbf.tar.gz
rust-07c415c2154f29d6dce8da0154ef41c8a5497fbf.zip
Auto merge of #51033 - coryshrmn:master, r=dtolnay
stabilize RangeBounds collections_range #30877

The FCP for #30877 closed last month, with the decision to:
1. move from `collections::range::RangeArgument` to `ops::RangeBounds`, and
2. rename `start()` and `end()` to `start_bounds()` and `end_bounds()`.

Simon Sapin already moved it to `ops::RangeBounds` in #49163.

I renamed the functions, and removed the old `collections::range::RangeArgument` alias.

This is my first Rust PR, please let me know if I can improve anything. This passes all tests for me, except the `clippy` tool (which uses `RangeArgument::start()`).

I considered deprecating `start()` and `end()` instead of removing them, but the contribution guidelines indicate we can break `clippy` temporarily. I thought it was best to remove the functions, since we're worried about name collisions with `Range::start` and `end`.

Closes #30877.
Diffstat (limited to 'src/liballoc/string.rs')
-rw-r--r--src/liballoc/string.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 449e3152d8f..a988b6a26d9 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1493,12 +1493,12 @@ impl String {
         // Because the range removal happens in Drop, if the Drain iterator is leaked,
         // the removal will not happen.
         let len = self.len();
-        let start = match range.start() {
+        let start = match range.start_bound() {
             Included(&n) => n,
             Excluded(&n) => n + 1,
             Unbounded => 0,
         };
-        let end = match range.end() {
+        let end = match range.end_bound() {
             Included(&n) => n + 1,
             Excluded(&n) => n,
             Unbounded => len,
@@ -1551,12 +1551,12 @@ impl String {
         // Replace_range does not have the memory safety issues of a vector Splice.
         // of the vector version. The data is just plain bytes.
 
-        match range.start() {
+        match range.start_bound() {
              Included(&n) => assert!(self.is_char_boundary(n)),
              Excluded(&n) => assert!(self.is_char_boundary(n + 1)),
              Unbounded => {},
         };
-        match range.end() {
+        match range.end_bound() {
              Included(&n) => assert!(self.is_char_boundary(n + 1)),
              Excluded(&n) => assert!(self.is_char_boundary(n)),
              Unbounded => {},