diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-07 11:58:31 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-07 17:35:56 -0500 |
| commit | 517f1cc63c1a5df148fdeef56791f66771d3d8e8 (patch) | |
| tree | 0d321b5be3d9610f460561e8dc446a2132bb5422 /src/libsyntax/util | |
| parent | 6e2bfe4ae8277f0cfe76831b446d50820b4527f5 (diff) | |
| download | rust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.tar.gz rust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.zip | |
use slicing sugar
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 93de342d487..1efbcf073c6 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 .index(&FullRange) +// when traits can extend traits, we should extend index<Name,T> to get [] 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.index(&FullRange).cmp(other.index(&FullRange)) + self[].cmp(&other[]) } } impl fmt::Show for RcStr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use std::fmt::Show; - self.index(&FullRange).fmt(f) + self[].fmt(f) } } impl BorrowFrom<RcStr> for str { fn borrow_from(owned: &RcStr) -> &str { - owned.string.index(&FullRange) + &owned.string[] } } impl Deref for RcStr { type Target = str; - fn deref(&self) -> &str { self.string.index(&FullRange) } + fn deref(&self) -> &str { &self.string[] } } /// 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 .index(&FullRange) +/// When traits can extend traits, we should extend index<Name,T> to get [] impl StrInterner { pub fn new() -> StrInterner { StrInterner { |
