Brendan Zabarauskas
ee4d11f37e
Use match instead of intermediate variable
2013-05-19 02:19:16 +10:00
Brendan Zabarauskas
ce1e211eeb
Adapt the getter macro to implement Clone, Eq and Ord for n-ary tuples
2013-05-19 02:19:16 +10:00
Brendan Zabarauskas
b6038b7633
Return a reference to the tuple elements instead of copying
2013-05-18 20:05:40 +10:00
Brendan Zabarauskas
5242464d54
Merge trait and impl macros by using an inner module
2013-05-18 19:43:14 +10:00
Brendan Zabarauskas
c1eb539e12
Use assert_eq! instead of assert!
2013-05-18 19:10:49 +10:00
Brendan Zabarauskas
96cb0dc8a0
use n{0..11} instead of _{0..12} for accessor method names
2013-05-18 19:10:12 +10:00
Brendan Zabarauskas
6742f91192
Create tuple element accessor traits
2013-05-18 18:59:16 +10:00
bors
e91daaa8a9
auto merge of #6586 : bjz/rust/formatting-and-conditionals, r=thestinger
2013-05-18 00:34:24 -07:00
Brendan Zabarauskas
ad6ee5f4e5
Use four-space indentation, add trailing commas, and remove unnecessary uses of the return keyword
2013-05-18 17:29:19 +10:00
Brendan Zabarauskas
60ea6d6957
Convert various inner doc-comments to outer doc-comments
2013-05-18 17:29:14 +10:00
Brendan Zabarauskas
728fe775a2
Use pattern-matching instead of conditionals where appropriate to improve code clarity
2013-05-18 17:29:12 +10:00
Brendan Zabarauskas
a10974da2d
Use cond! macro where appropriate
2013-05-18 17:29:07 +10:00
bors
799d9fa32b
auto merge of #6560 : gifnksm/rust/iterator-utils, r=thestinger
...
This pull request adds following methods and traits.
```rust
pub trait IteratorUtil {
(snip)
fn filter_map<'r, B>(self, f: &'r fn(A) -> Option<B>) -> FilterMapIterator<'r, A, B, Self>;
(snip)
fn to_vec(self) -> ~[A];
fn nth(&mut self, n: uint) -> A;
fn first(&mut self) -> A;
fn last(&mut self) -> A;
fn fold<B>(&mut self, start: B, f: &fn(B, A) -> B) -> B;
fn count(&mut self) -> uint;
fn all(&mut self, f: &fn(&A) -> bool) -> bool;
fn any(&mut self, f: &fn(&A) -> bool) -> bool;
}
pub trait AdditiveIterator<A> {
fn sum(&mut self) -> A;
}
pub trait MultiplicativeIterator<A> {
fn product(&mut self) -> A;
}
pub trait OrdIterator<A> {
fn max(&mut self) -> Option<A>;
fn min(&mut self) -> Option<A>;
}
```
2013-05-17 19:58:24 -07:00
Marvin Löbel
916942d006
Some cosmetic changes to num.rs
2013-05-18 00:25:03 +02:00
gifnksm
3122d8027b
libcore: Add IteratorUtil::all
, any
method
2013-05-18 00:24:43 +09:00
gifnksm
54fbac505e
libcore: Add AdditiveIterator
, MultiplicativeIterator
, OrdIterator
2013-05-18 00:18:09 +09:00
gifnksm
b4cea351ba
libcore: Add IteratorUtil::fold
, count
2013-05-18 00:17:56 +09:00
gifnksm
02945f1cb1
libcore: Add IteratoUtil::nth
, first
, last
method
2013-05-17 23:49:11 +09:00
gifnksm
9ffbe69234
libcore: Add IteratorUtil::filter_map
method
2013-05-17 23:00:48 +09:00
gifnksm
f7e58ebe84
libcore: Add IteratorUtil::to_vec()
method
2013-05-17 22:54:32 +09:00
bors
290a2ebab6
auto merge of #6442 : sstewartgallus/rust/incoming, r=pcwalton
...
Added unit test to prevent similar mistakes from happening again. The
previous method was wrong because it dereferenced a pointer to a void type to
match on the result. No self pointer was needed, and the correct method
signature took the self value by value.
I feel silly that I made this mistake in https://github.com/mozilla/rust/pull/6348
2013-05-17 06:46:32 -07:00
bors
dbbc244f73
auto merge of #6534 : brson/rust/intrinsic-docs, r=bstrie
2013-05-17 05:22:32 -07:00
bors
8badea49b0
auto merge of #6549 : bjz/rust/numeric-traits, r=thestinger
...
As discussed on issue #4819 . This is a naive implementation, trusting LLVM to do the relevant optimizations. In the future this could be implemented more efficiently, but it's a start.
2013-05-16 23:43:30 -07:00
bors
c69f8ea91a
auto merge of #6093 : alexcrichton/rust/issue-2647, r=thestinger
...
Closes #2647
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted. This involved pretty much rewriting how lints are emitted. Beforehand, only items could alter the lint settings, so whenever a lint was added it had to be associated with whatever item id it was coming from. I removed this (possibly questionably) in favor of just specifying a span and a message when adding a lint. When lint checking comes around, it looks at all the lints and sees which node with attributes best encloses it and uses that level of linting. This means that all consumer code doesn't have to deal with what item things came from (especially because functions on impls aren't items). More details of this can be found in the code (and comments).
As a bonus, I managed to greatly simplify emission of lints in resolve.rs about unused imports. Now instead of it manually tracking what the lint level is, it's all moved over into the lint module (as is to be expected).
2013-05-16 22:25:39 -07:00
Alex Crichton
030c666cc1
Re-implement lint with less emphasis on item ids
...
This way it's much easier to add lints throughout compilation correctly, and
functions on impls can alter the way lints are emitted.
2013-05-17 00:49:16 -04:00
bors
918bfa710c
auto merge of #6546 : cmr/rust/warning, r=thestinger
2013-05-16 21:19:38 -07:00
bors
77c98f0815
auto merge of #6523 : cmr/rust/faster_each_permutation, r=luqmana
...
Closes #5127
2013-05-16 20:04:41 -07:00
Corey Richardson
af54d58891
Update to new for-loop protocol
2013-05-16 22:57:49 -04:00
Brendan Zabarauskas
5696081781
Implement sin_cos method for float, f64 and f32
2013-05-17 12:30:02 +10:00
Corey Richardson
c67a85ada1
Remove each_permutation_ref
2013-05-16 22:05:05 -04:00
Corey Richardson
c2baaa8d84
fix warnings
2013-05-16 21:53:54 -04:00
Daniel Micay
08ef229a65
iter: add fold, sum and product
2013-05-16 21:51:31 -04:00
Corey Richardson
c99d1de85b
Update to modern rust
2013-05-16 20:59:06 -04:00
Tommy M. McGuire
5948d8a826
Ensure reverse_part does not access outside given vector
2013-05-16 20:59:06 -04:00
Tommy M. McGuire
2264c7927d
Add reverse_part, replace each_permutation, add tests
2013-05-16 20:59:06 -04:00
Brian Anderson
305331c00f
core: Document some intrinsics
2013-05-16 12:03:58 -07:00
bors
92a1f6de97
auto merge of #6509 : thestinger/rust/clone, r=nikomatsakis
...
somewhat annoying to actually call thanks to auto-deref, but it does let `deriving(Clone)` work
2013-05-16 01:07:45 -07:00
bors
92b7a45395
auto merge of #6488 : sammykim/rust/issue-6430, r=sanxiyn
...
Fix issue #6430 .
2013-05-15 22:52:47 -07:00
Sangeun Kim
f097f4309e
Change unsafe functions to safe functions
2013-05-16 13:34:32 +09:00
bors
62caa1e5c8
auto merge of #6505 : cmr/rust/unsetenv, r=catamorphism
2013-05-15 21:31:45 -07:00
bors
f6360b4eab
auto merge of #6527 : thestinger/rust/deep_clone, r=pcwalton
2013-05-15 20:28:45 -07:00
bors
2329651770
auto merge of #6503 : sonwow/rust/at_vec-renamed, r=graydon
...
`str::from_slice` and `vec::from_slice` are changed to `str::to_owned` and `vec::to_owned`. (#6389 )
Replace `at_vec::from_owned` and `at_vec::from_slice` with `at_vec::to_managed_consume` and `at_vec::to_managed`.
2013-05-15 19:22:49 -07:00
Daniel Micay
d6a8343470
add DeepClone impl for @T and @mut T with T: Const
2013-05-15 21:02:54 -04:00
bors
08b4cdd395
auto merge of #6499 : dotdash/rust/static_keywords, r=thestinger
2013-05-15 15:10:48 -07:00
Daniel Micay
22c3db5df7
add a Clone impl for borrowed pointers
2013-05-15 15:58:20 -04:00
bors
8a15333c06
auto merge of #6498 : thestinger/rust/deep_clone, r=thestinger
...
This is mostly for `std::rc` and `std::arc` (but I haven't implemented it for ARC yet).
Implementing it correctly for managed boxes is *very* non-trivial. It would probably require an unholy mix of reflection and TLS.
2013-05-15 12:22:58 -07:00
Corey Richardson
6ef226d5d9
Add unsetenv wrapper
2013-05-15 13:40:35 -04:00
bors
bcec83aaee
auto merge of #6493 : brson/rust/tls, r=thestinger
2013-05-15 10:14:04 -07:00
Youngsoo Son
f11297f608
rename at_vec::from_owned
and at_vec::from_slice
to at_vec::to_managed_consume
and at_vec::to_managed
2013-05-16 00:33:54 +09:00
bors
4e82610099
auto merge of #6487 : recrack/rust/vec_len, r=thestinger
...
Rename vec::len(var) to var.len()
```
libcore, libfuzzer, librustc, librustdoc, libstd, libsyntax
test/auxiliary
test/bench
test/run-pass
```
2013-05-15 07:38:07 -07:00