forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#54295 - ljedrz:cleanups_rustc_traits, r=nik…
…omatsakis A few cleanups and minor improvements to rustc/traits It's a little bigger than usual, so bear with me ^^: - introduce `TyCtxt::all_impls` and use it to avoid inefficiently allocating push loops - modify `ArgKind::from_expected_ty` to take an `Option<Span>` argument to make it more versatile - replace `ArgKind::Arg("_".to_owned(), "_".to_owned())` with `ArgKind::empty` - move early `return`s earlier where possible - if all branches of a `match` end with the same expression, move it after it - change a hacky `match` expression to an `if else` chain - move the `push` out from a push loop closure to reduce the number of allocations - correct the vector size for `pretty_predicates` (under `specialize`) - take advantage of the fact that `if else` is an expression - prefer `cloned()` to `map(|&x| x)` and `map(|x| *x)` - prefer `vec![x; y.len()]` to `y.map(|_| x).collect()` - use `unwrap_or_else` instead of `match` where applicable - use `if let` instead of `match` when only one branch matters - prefer `to_owned` to `to_string` for string literals - remove explicit `return`s - remove superfluous braces - whitespace fixes - several other minor improvements
- Loading branch information
Showing
18 changed files
with
414 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.