Skip to content

Commit b14293f

Browse files
committed
---
yaml --- r: 15855 b: refs/heads/try c: aec0b51 h: refs/heads/master i: 15853: 83a2b42 15851: 54de7f9 15847: 978bd64 15839: df81110 v: v3
1 parent c0548f6 commit b14293f

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 9fa4763604b8d9bd342d5ead58442ef1b3643b5a
5+
refs/heads/try: aec0b51d9cca576b38023c4f8a11f28452ea8d55
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/vec.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,16 @@ fn all<T>(v: [T], f: fn(T) -> bool) -> bool {
580580
ret true;
581581
}
582582

583+
#[doc = "
584+
Return true if a predicate matches all elements
585+
586+
If the vector contains no elements then true is returned.
587+
"]
588+
fn alli<T>(v: [T], f: fn(uint, T) -> bool) -> bool {
589+
for eachi(v) {|i, elem| if !f(i, elem) { ret false; } }
590+
ret true;
591+
}
592+
583593
#[doc = "
584594
Return true if a predicate matches all elements in both vectors.
585595
@@ -1107,6 +1117,12 @@ impl extensions<T> for [T] {
11071117
let mut i = 0u;
11081118
self.map { |e| i += 1u; f(i - 1u, e) }
11091119
}
1120+
#[doc = "Returns true if the function returns true for all elements.
1121+
1122+
If the vector is empty, true is returned."]
1123+
fn alli(f: fn(uint, T) -> bool) -> bool {
1124+
alli(self, f)
1125+
}
11101126
#[doc = "
11111127
Apply a function to each element of a vector and return a concatenation
11121128
of each result vector

branches/try/src/librustsyntax/print/pprust.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ fn print_region(s: ps, region: @ast::region) {
337337
}
338338

339339
fn print_type(s: ps, &&ty: @ast::ty) {
340+
print_type_ex(s, ty, false);
341+
}
342+
343+
fn print_type_ex(s: ps, &&ty: @ast::ty, print_colons: bool) {
340344
maybe_print_comment(s, ty.span.lo);
341345
ibox(s, 0u);
342346
alt ty.node {
@@ -384,7 +388,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
384388
ast::ty_fn(proto, d) {
385389
print_ty_fn(s, some(proto), d, none, none);
386390
}
387-
ast::ty_path(path, _) { print_path(s, path, false); }
391+
ast::ty_path(path, _) { print_path(s, path, print_colons); }
388392
ast::ty_constr(t, cs) {
389393
print_type(s, t);
390394
space(s.s);
@@ -961,7 +965,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
961965
print_op_maybe_parens(s, expr, parse::prec::as_prec);
962966
space(s.s);
963967
word_space(s, "as");
964-
print_type(s, ty);
968+
print_type_ex(s, ty, true);
965969
}
966970
ast::expr_if(test, blk, elseopt) {
967971
print_if(s, test, blk, elseopt, false);

0 commit comments

Comments
 (0)