Skip to content

Commit 7190867

Browse files
brsonalexcrichton
authored andcommitted
---
yaml --- r: 152391 b: refs/heads/try2 c: 50942c7 h: refs/heads/master i: 152389: 6958f4e 152387: 065e1c4 152383: 19e9b64 v: v3
1 parent 31457a7 commit 7190867

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+111
-147
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a6a9e09f98cceecc866c5e6a0d9392735c351ae6
8+
refs/heads/try2: 50942c7695783875bd2161596036a52755ffb09c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcollections/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ impl<S: hash::Writer> hash::Hash<S> for BitvSet {
857857
}
858858
}
859859

860-
impl Container for BitvSet {
860+
impl Collection for BitvSet {
861861
#[inline]
862862
fn len(&self) -> uint { self.size }
863863
}

branches/try2/src/libcollections/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn link_with_prev<T>(mut next: Box<Node<T>>, prev: Rawlink<Node<T>>)
125125
Some(next)
126126
}
127127

128-
impl<T> Container for DList<T> {
128+
impl<T> Collection for DList<T> {
129129
/// O(1)
130130
#[inline]
131131
fn is_empty(&self) -> bool {

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct PriorityQueue<T> {
2626
data: Vec<T>,
2727
}
2828

29-
impl<T: Ord> Container for PriorityQueue<T> {
29+
impl<T: Ord> Collection for PriorityQueue<T> {
3030
/// Returns the length of the queue
3131
fn len(&self) -> uint { self.data.len() }
3232
}

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct RingBuf<T> {
3333
elts: Vec<Option<T>>
3434
}
3535

36-
impl<T> Container for RingBuf<T> {
36+
impl<T> Collection for RingBuf<T> {
3737
/// Return the number of elements in the RingBuf
3838
fn len(&self) -> uint { self.nelts }
3939
}

branches/try2/src/libcollections/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub struct SmallIntMap<T> {
2929
v: Vec<Option<T>>,
3030
}
3131

32-
impl<V> Container for SmallIntMap<V> {
32+
impl<V> Collection for SmallIntMap<V> {
3333
/// Return the number of elements in the map
3434
fn len(&self) -> uint {
3535
self.v.iter().filter(|elt| elt.is_some()).count()

branches/try2/src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ impl<'a> StrAllocating for MaybeOwned<'a> {
610610
}
611611
}
612612

613-
impl<'a> Container for MaybeOwned<'a> {
613+
impl<'a> Collection for MaybeOwned<'a> {
614614
#[inline]
615615
fn len(&self) -> uint { self.as_slice().len() }
616616
}
@@ -2036,7 +2036,7 @@ mod tests {
20362036

20372037
#[test]
20382038
fn test_str_container() {
2039-
fn sum_len<S: Container>(v: &[S]) -> uint {
2039+
fn sum_len<S: Collection>(v: &[S]) -> uint {
20402040
v.iter().map(|x| x.len()).sum()
20412041
}
20422042

branches/try2/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl String {
279279
}
280280
}
281281

282-
impl Container for String {
282+
impl Collection for String {
283283
#[inline]
284284
fn len(&self) -> uint {
285285
self.vec.len()

branches/try2/src/libcollections/treemap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
8686
}
8787
}
8888

89-
impl<K: Ord, V> Container for TreeMap<K, V> {
89+
impl<K: Ord, V> Collection for TreeMap<K, V> {
9090
fn len(&self) -> uint { self.length }
9191
}
9292

@@ -579,7 +579,7 @@ impl<T: Ord + Show> Show for TreeSet<T> {
579579
}
580580
}
581581

582-
impl<T: Ord> Container for TreeSet<T> {
582+
impl<T: Ord> Collection for TreeSet<T> {
583583
#[inline]
584584
fn len(&self) -> uint { self.map.len() }
585585
}

branches/try2/src/libcollections/trie.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct TrieMap<T> {
3838
length: uint
3939
}
4040

41-
impl<T> Container for TrieMap<T> {
41+
impl<T> Collection for TrieMap<T> {
4242
/// Return the number of elements in the map
4343
#[inline]
4444
fn len(&self) -> uint { self.length }
@@ -285,7 +285,7 @@ pub struct TrieSet {
285285
map: TrieMap<()>
286286
}
287287

288-
impl Container for TrieSet {
288+
impl Collection for TrieSet {
289289
/// Return the number of elements in the set
290290
#[inline]
291291
fn len(&self) -> uint { self.map.len() }

branches/try2/src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl<T: Ord> Ord for Vec<T> {
393393
}
394394
}
395395

396-
impl<T> Container for Vec<T> {
396+
impl<T> Collection for Vec<T> {
397397
#[inline]
398398
fn len(&self) -> uint {
399399
self.len

branches/try2/src/libcore/container.rs renamed to branches/try2/src/libcore/collections.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Traits for generic containers (including `Map` and `Set`)
11+
//! Traits for generic collections (including `Map` and `Set`)
1212
1313
use option::Option;
1414

1515
/// A trait to represent the abstract idea of a container. The only concrete
1616
/// knowledge known is the number of elements contained within.
17-
pub trait Container {
17+
pub trait Collection {
1818
/// Return the number of elements in the container
1919
fn len(&self) -> uint;
2020

@@ -26,14 +26,14 @@ pub trait Container {
2626
}
2727

2828
/// A trait to represent mutable containers
29-
pub trait Mutable: Container {
29+
pub trait Mutable: Collection {
3030
/// Clear the container, removing all values.
3131
fn clear(&mut self);
3232
}
3333

3434
/// A map is a key-value store where values may be looked up by their keys. This
3535
/// trait provides basic operations to operate on these stores.
36-
pub trait Map<K, V>: Container {
36+
pub trait Map<K, V>: Collection {
3737
/// Return a reference to the value corresponding to the key
3838
fn find<'a>(&'a self, key: &K) -> Option<&'a V>;
3939

@@ -76,7 +76,7 @@ pub trait MutableMap<K, V>: Map<K, V> + Mutable {
7676
/// A set is a group of objects which are each distinct from one another. This
7777
/// trait represents actions which can be performed on sets to iterate over
7878
/// them.
79-
pub trait Set<T>: Container {
79+
pub trait Set<T>: Collection {
8080
/// Return true if the set contains a value
8181
fn contains(&self, value: &T) -> bool;
8282

branches/try2/src/libcore/fmt/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(missing_doc)]
1212

1313
use char;
14-
use container::Container;
14+
use collections::Collection;
1515
use fmt;
1616
use iter::{Iterator, range, DoubleEndedIterator};
1717
use num::{Float, FPNaN, FPInfinite, ToPrimitive, Primitive};

branches/try2/src/libcore/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use any;
1616
use cell::Cell;
1717
use char::Char;
18-
use container::Container;
18+
use collections::Collection;
1919
use iter::{Iterator, range};
2020
use kinds::Copy;
2121
use mem;

branches/try2/src/libcore/fmt/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#![allow(unsigned_negate)]
1616

17-
use container::Container;
17+
use collections::Collection;
1818
use fmt;
1919
use iter::{Iterator, DoubleEndedIterator};
2020
use num::{Int, cast, zero};

branches/try2/src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub mod ptr;
108108
#[cfg(not(test))] pub mod cmp;
109109
pub mod clone;
110110
pub mod default;
111-
pub mod container;
111+
pub mod collections;
112112

113113
/* Core types and methods on primitives */
114114

branches/try2/src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub use char::Char;
4747
pub use clone::Clone;
4848
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
4949
pub use cmp::{Ordering, Less, Equal, Greater, Equiv};
50-
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
50+
pub use collections::Collection;
5151
pub use iter::{FromIterator, Extendable};
5252
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
5353
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};

branches/try2/src/libcore/should_not_exist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Currently, no progress has been made on this list.
2626

2727
use clone::Clone;
28-
use container::Container;
28+
use collections::Collection;
2929
use finally::try_finally;
3030
use intrinsics;
3131
use iter::{range, Iterator};

branches/try2/src/libcore/slice.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use mem::transmute;
1818
use clone::Clone;
19-
use container::Container;
19+
use collections::Collection;
2020
use cmp::{PartialEq, Ord, Ordering, Less, Equal, Greater};
2121
use cmp;
2222
use default::Default;
@@ -253,7 +253,7 @@ pub mod traits {
253253

254254
use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Equiv};
255255
use iter::order;
256-
use container::Container;
256+
use collections::Collection;
257257

258258
impl<'a,T:PartialEq> PartialEq for &'a [T] {
259259
fn eq(&self, other: & &'a [T]) -> bool {
@@ -347,15 +347,15 @@ impl<T> Vector<T> for ~[T] {
347347
fn as_slice<'a>(&'a self) -> &'a [T] { let v: &'a [T] = *self; v }
348348
}
349349

350-
impl<'a, T> Container for &'a [T] {
350+
impl<'a, T> Collection for &'a [T] {
351351
/// Returns the length of a vector
352352
#[inline]
353353
fn len(&self) -> uint {
354354
self.repr().len
355355
}
356356
}
357357

358-
impl<T> Container for ~[T] {
358+
impl<T> Collection for ~[T] {
359359
/// Returns the length of a vector
360360
#[inline]
361361
fn len(&self) -> uint {
@@ -1205,7 +1205,7 @@ pub mod raw {
12051205

12061206
/// Operations on `[u8]`.
12071207
pub mod bytes {
1208-
use container::Container;
1208+
use collections::Collection;
12091209
use ptr;
12101210
use slice::MutableVector;
12111211

branches/try2/src/libcore/str.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use char;
1919
use clone::Clone;
2020
use cmp;
2121
use cmp::{PartialEq, Eq};
22-
use container::Container;
22+
use collections::Collection;
2323
use default::Default;
2424
use iter::{Filter, Map, Iterator};
2525
use iter::{DoubleEndedIterator, ExactSize};
@@ -866,7 +866,7 @@ static TAG_CONT_U8: u8 = 128u8;
866866
/// Unsafe operations
867867
pub mod raw {
868868
use mem;
869-
use container::Container;
869+
use collections::Collection;
870870
use ptr::RawPtr;
871871
use raw::Slice;
872872
use slice::{ImmutableVector};
@@ -930,8 +930,8 @@ Section: Trait implementations
930930
#[cfg(not(test))]
931931
#[allow(missing_doc)]
932932
pub mod traits {
933-
use container::Container;
934933
use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq};
934+
use collections::Collection;
935935
use iter::Iterator;
936936
use option::{Some, None};
937937
use str::{Str, StrSlice, eq_slice};
@@ -987,7 +987,7 @@ impl<'a> Str for &'a str {
987987
fn as_slice<'a>(&'a self) -> &'a str { *self }
988988
}
989989

990-
impl<'a> Container for &'a str {
990+
impl<'a> Collection for &'a str {
991991
#[inline]
992992
fn len(&self) -> uint {
993993
self.repr().len

branches/try2/src/libregex/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ impl<'t> Captures<'t> {
775775
}
776776
}
777777

778-
impl<'t> Container for Captures<'t> {
778+
impl<'t> Collection for Captures<'t> {
779779
/// Returns the number of captured groups.
780780
#[inline]
781781
fn len(&self) -> uint {

branches/try2/src/librustc/middle/lint.rs

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,21 +1253,12 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::Item) {
12531253
!ident.char_at(0).is_lowercase() && !ident.contains_char('_')
12541254
}
12551255

1256-
fn to_camel_case(s: &str) -> String {
1257-
s.split('_').flat_map(|word| word.chars().enumerate().map(|(i, c)|
1258-
if i == 0 { c.to_uppercase() }
1259-
else { c }
1260-
)).collect()
1261-
}
1262-
12631256
fn check_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
1264-
let s = token::get_ident(ident);
1265-
12661257
if !is_camel_case(ident) {
12671258
cx.span_lint(
12681259
NonCamelCaseTypes, span,
1269-
format!("{} `{}` should have a camel case name such as `{}`",
1270-
sort, s, to_camel_case(s.get())).as_slice());
1260+
format!("{} `{}` should have a camel case identifier",
1261+
sort, token::get_ident(ident)).as_slice());
12711262
}
12721263
}
12731264

@@ -1305,29 +1296,10 @@ fn check_snake_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
13051296
})
13061297
}
13071298

1308-
fn to_snake_case(str: &str) -> String {
1309-
let mut words = vec![];
1310-
for s in str.split('_') {
1311-
let mut buf = String::new();
1312-
if s.is_empty() { continue; }
1313-
for ch in s.chars() {
1314-
if !buf.is_empty() && ch.is_uppercase() {
1315-
words.push(buf);
1316-
buf = String::new();
1317-
}
1318-
buf.push_char(ch.to_lowercase());
1319-
}
1320-
words.push(buf);
1321-
}
1322-
words.connect("_")
1323-
}
1324-
1325-
let s = token::get_ident(ident);
1326-
13271299
if !is_snake_case(ident) {
13281300
cx.span_lint(NonSnakeCaseFunctions, span,
1329-
format!("{} `{}` should have a snake case name such as `{}`",
1330-
sort, s, to_snake_case(s.get())).as_slice());
1301+
format!("{} `{}` should have a snake case identifier",
1302+
sort, token::get_ident(ident)).as_slice());
13311303
}
13321304
}
13331305

@@ -1341,10 +1313,7 @@ fn check_item_non_uppercase_statics(cx: &Context, it: &ast::Item) {
13411313
// upper/lowercase)
13421314
if s.get().chars().any(|c| c.is_lowercase()) {
13431315
cx.span_lint(NonUppercaseStatics, it.span,
1344-
format!("static constant `{}` should have an uppercase name \
1345-
such as `{}`", s.get(),
1346-
s.get().chars().map(|c| c.to_uppercase())
1347-
.collect::<String>().as_slice()).as_slice());
1316+
"static constant should have an uppercase identifier");
13481317
}
13491318
}
13501319
_ => {}
@@ -1360,10 +1329,7 @@ fn check_pat_non_uppercase_statics(cx: &Context, p: &ast::Pat) {
13601329
let s = token::get_ident(ident);
13611330
if s.get().chars().any(|c| c.is_lowercase()) {
13621331
cx.span_lint(NonUppercasePatternStatics, path.span,
1363-
format!("static constant in pattern `{}` should have an uppercase \
1364-
name such as `{}`", s.get(),
1365-
s.get().chars().map(|c| c.to_uppercase())
1366-
.collect::<String>().as_slice()).as_slice());
1332+
"static constant in pattern should be all caps");
13671333
}
13681334
}
13691335
_ => {}

0 commit comments

Comments
 (0)