Commit Graph

34842 Commits

Author SHA1 Message Date
bors
83a44c7fa6 auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichton
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns:

- `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")`
- `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")`
- `vec.as_mut_slice().sort()` -> `vec.sort()`
- `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)`

---

Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation.

This is rebased on top of #19167

cc @alexcrichton @aturon
2014-12-08 02:32:31 +00:00
bors
8bca470c5a auto merge of #19561 : csouth3/rust/treeset-bitops, r=Gankro
Implement the `BitOr`, `BitAnd`, `BitXor`, and `Sub` traits from `std::ops` for TreeSet.  The behavior of these operator overloads is consistent with [RFC 235](https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#combinations).

r? @Gankro
2014-12-08 00:12:30 +00:00
bors
77cd5cc54e auto merge of #19548 : luqmana/rust/mfb, r=nikomatsakis
Fixes #19367.
2014-12-07 19:02:18 +00:00
bors
558f8d8e3e auto merge of #19539 : cmr/rust/18959, r=nikomatsakis
Closes #18959

Technically, this causes code that once compiled to no longer compile, but
that code probably never ran.

[breaking-change]

------------

Not quite sure the error message is good enough, I feel like it ought to tell you "because it inherits from non-object-safe trait Foo", so I've opened up a follow-up issue #19538
2014-12-07 16:12:22 +00:00
Jorge Aparicio
1fea900de7 Fix syntax error on android tests 2014-12-07 08:49:17 -05:00
bors
a243e8820a auto merge of #19522 : mukilan/rust/import-conflicts-item, r=cmr
Fixes #19498
2014-12-07 13:42:18 +00:00
bors
1e835cc7e3 auto merge of #19488 : jbranchaud/rust/add-btree-set-doctests, r=alexcrichton
There is already a test for `union` in the test namespace, but this commit adds a doctest that will appear in the rustdocs.

Someone on IRC said, *Write doctests!*, so here I am.

I am not sure this is the best way to demonstrate the behavior of the union function, so I am open to suggestions for improving this. If I am on the right track I'd be glad to include similar doctests for `intersection`, `difference`, etc.
2014-12-07 07:12:16 +00:00
Jorge Aparicio
2ed42bfbd1 libtime: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
66f52f4c9b libtest: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
00c7786690 libterm: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
93e99b55f8 libsyntax: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
c2da923fc9 libstd: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
ba01ea3730 libserialize: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
71d8d578c6 librustc_back: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
8379d72293 libgetopts: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
98ae63753b libcollections: remove unnecessary to_string() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
976660f3f7 libtest: remove unnecessary as_mut_slice() calls 2014-12-06 23:53:02 -05:00
Jorge Aparicio
6132a90788 libstd: remove unnecessary as_mut_slice calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
5172981207 librustdoc: remove unnecessary as_mut_slice calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
a0a354ff22 librustc_trans: remove unnecessary as_mut_slice calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
d64fd22c71 librustc: remove unnecessary as_mut_slice calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
5a24058889 libcollections: remove unnecessary as_mut_slice() calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
a0621f8eba libtest: remove unnecessary as_slice() calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
53b479c195 libterm: remove unnecessary as_slice() calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
39f44c0c20 libsyntax: remove unnecessary as_slice() calls 2014-12-06 23:53:01 -05:00
Jorge Aparicio
60338d91c4 libstd: remove unnecessary as_slice() calls 2014-12-06 23:53:00 -05:00
bors
f7d18b92f8 auto merge of #19407 : frewsxcv/rust/rm-reexports, r=cmr
In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::\*, Result::\*, and Ordering::\*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized
2014-12-07 04:12:20 +00:00
Mukilan Thiyagarajan
4b75a5d8da Add compile-fail tests for #19498 2014-12-07 07:37:15 +05:30
Jorge Aparicio
09f7713dd4 libserialize: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
e6bd217ce8 librustdoc: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
8bb5ef9df5 librustc_trans: remove unnecessary as_slice calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
7d8eabb226 librustc_back: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
00f3c3f7a7 librustc: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
ae555a99a6 libregex_macros: remove unnecessary as_slice calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
89e6a81ef9 libregex: remove unnecessary as_slice calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
0ea31348d9 liblog: remove unnecessary as_slice calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
c0ef959b31 libgraphviz: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
6efc87945b libgetops: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
a7960136ac libfmt_macros: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
0f54f32a9c libflate: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
5257a5b284 libcoretest: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
0ac3b166df liballoc: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
Jorge Aparicio
f2af07e6d5 libcollections: remove unnecessary as_slice() calls 2014-12-06 19:05:58 -05:00
bors
a31ad6bfcd auto merge of #19579 : alexcrichton/rust/snapshots, r=nikomatsakis 2014-12-06 23:12:17 +00:00
bors
de83d7dd19 auto merge of #19431 : erickt/rust/buf-writer-error, r=alexcrichton
Previously, `BufWriter::write` would just return an `std::io::OtherIoError` if someone attempted to write past the end of the wrapped buffer. This pull request changes the error to support partial writes and return a `std::io::ShortWrite`, or an `io::io::EndOfFile` if it's been fully exhausted.

 I've also optimized away a bounds check inside `BufWriter::write`, which should help shave off some nanoseconds in an inner loops.
2014-12-06 20:12:13 +00:00
bors
358db12a89 auto merge of #19590 : sfackler/rust/fix-android, r=sfackler
Seems to be blocking forever
2014-12-06 17:42:16 +00:00
Steven Fackler
2e2aca9eb8 Ignore wait-forked-but-failed-child
Test will be fixed in #19588
2014-12-06 08:13:57 -08:00
Corey Richardson
6e18b5af93 rustc: check supertraits for object safety
Closes #18959

Technically, this causes code that once compiled to no longer compile, but
that code probably never ran.

[breaking-change]
2014-12-05 22:27:21 -08:00
Steven Fackler
8a288d3aff Ignore issue #16671 test on android
Seems to be blocking forever
2014-12-05 20:22:35 -08:00
Chase Southwood
da50db0ca2 Implement BitOps for TreeSet 2014-12-05 18:03:45 -06:00