diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-01-02 13:56:28 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-01-07 10:46:33 +1300 |
| commit | f7ff37e4c52a1d6562635fcd5bab6309cf75ea08 (patch) | |
| tree | 9c69736bf3830f9048f61d45943bf0fa6326782d /src/libsyntax/util | |
| parent | 918255ef8c3c21b2009204c3019239f8dc9f46bf (diff) | |
| download | rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.tar.gz rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.zip | |
Replace full slice notation with index calls
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/interner.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 85eea2d9daf..93de342d487 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -28,7 +28,7 @@ pub struct Interner<T> { vect: RefCell<Vec<T> >, } -// when traits can extend traits, we should extend index<Name,T> to get [] +// when traits can extend traits, we should extend index<Name,T> to get .index(&FullRange) impl<T: Eq + Hash + Clone + 'static> Interner<T> { pub fn new() -> Interner<T> { Interner { @@ -109,27 +109,27 @@ impl Eq for RcStr {} impl Ord for RcStr { fn cmp(&self, other: &RcStr) -> Ordering { - self[].cmp(other[]) + self.index(&FullRange).cmp(other.index(&FullRange)) } } impl fmt::Show for RcStr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use std::fmt::Show; - self[].fmt(f) + self.index(&FullRange).fmt(f) } } impl BorrowFrom<RcStr> for str { fn borrow_from(owned: &RcStr) -> &str { - owned.string[] + owned.string.index(&FullRange) } } impl Deref for RcStr { type Target = str; - fn deref(&self) -> &str { self.string[] } + fn deref(&self) -> &str { self.string.index(&FullRange) } } /// A StrInterner differs from Interner<String> in that it accepts @@ -139,7 +139,7 @@ pub struct StrInterner { vect: RefCell<Vec<RcStr> >, } -/// When traits can extend traits, we should extend index<Name,T> to get [] +/// When traits can extend traits, we should extend index<Name,T> to get .index(&FullRange) impl StrInterner { pub fn new() -> StrInterner { StrInterner { |
