8000 Rollup of 7 pull requests by Dylan-DPC-zz · Pull Request #68975 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 7 pull requests #68975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 9, 2020
Merged
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fa9bfeb
Fix and test implementation of BTreeMap's first_entry, last_entry, po…
ssomers Feb 4, 2020
c00d8aa
Reorder declarations of Result::export/unwrap to match Option
brson Feb 5, 2020
db9b578
Reorder declarations of Result::expect_err/unwrap_err to match Option
brson Feb 5, 2020
8251e12
Don't use the word 'unwrap' to describe core unwrapping functions
brson Feb 7, 2020
1177d06
Clean up E0277 and E0282 explanations
GuillaumeGomez Feb 8, 2020
d6ccbf6
rustc_codegen_llvm: remove unnecessary special-casing of root scopes'…
eddyb Feb 8, 2020
1385fc4
rustc_codegen_llvm: remove InternalDebugLocation and simplify dbg_var…
eddyb Feb 8, 2020
bdb72e7
rustc_codegen_ssa: remove unnecessary source_locations_enabled.
eddyb Feb 8, 2020
4ac468c
Mark several functions and methods in core::cmp as #[must_use]
mjbshaw Feb 8, 2020
51b891a
Reduce Vec allocations in normalization by passing &mut Vec
Marwes Jan 8, 2020
619051e
Move librustc_hir/def_id.rs to librustc_span/def_id.rs
Aaron1011 Feb 8, 2020
d17bc9f
Rollup merge of #68718 - Aaron1011:move-def-hir-span, r=petrochenkov
Dylan-DPC Feb 8, 2020
cb87c95
Rollup merge of #68834 - ssomers:btree_first_last_fix68829, r=KodrAus
Dylan-DPC Feb 8, 2020
664d87f
Rollup merge of #68857 - Marwes:allocations, r=matthewjasper
Dylan-DPC Feb 8, 2020
2be062a
Rollup merge of #68918 - brson:unwrapdoc, r=Dylan-DPC
Dylan-DPC Feb 8, 2020
d6087b9
Rollup merge of #68946 - mjbshaw:must_use, r=mjbshaw
Dylan-DPC Feb 8, 2020
8333115
Rollup merge of #68958 - GuillaumeGomez:clean-up-e0277-e0282, r=Dylan…
Dylan-DPC Feb 8, 2020
9dabf80
Rollup merge of #68960 - eddyb:llvm-dbg-cleanup, r=nagisa
Dylan-DPC Feb 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ impl Ordering {
/// assert!(data == b);
/// ```
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn reverse(self) -> Ordering {
match self {
Expand Down Expand Up @@ -398,6 +399,7 @@ impl Ordering {
/// assert_eq!(result, Ordering::Less);
/// ```
#[inline]
#[must_use]
#[stable(feature = "ordering_chaining", since = "1.17.0")]
pub fn then(self, other: Ordering) -> Ordering {
match self {
Expand Down Expand Up @@ -435,6 +437,7 @@ impl Ordering {
/// assert_eq!(result, Ordering::Less);
/// ```
#[inline]
#[must_use]
#[stable(feature = "ordering_chaining", since = "1.17.0")]
pub fn then_with<F: FnOnce() -> Ordering>(self, f: F) -> Ordering {
match self {
Expand Down Expand Up @@ -576,6 +579,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// assert_eq!(10.cmp(&5), Ordering::Greater);
/// assert_eq!(5.cmp(&5), Ordering::Equal);
/// ```
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
fn cmp(&self, other: &Self) -> Ordering;

Expand All @@ -591,6 +595,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline]
#[must_use]
fn max(self, other: Self) -> Self
where
Self: Sized,
Expand All @@ -610,6 +615,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline]
#[must_use]
fn min(self, other: Self) -> Self
where
Self: Sized,
Expand All @@ -635,6 +641,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// assert!(0.clamp(-2, 1) == 0);
/// assert!(2.clamp(-2, 1) == 1);
/// ```
#[must_use]
#[unstable(feature = "clamp", issue = "44095")]
fn clamp(self, min: Self, max: Self) -> Self
where
Expand Down Expand Up @@ -915,6 +922,7 @@ pub macro PartialOrd($item:item) {
/// assert_eq!(2, cmp::min(2, 2));
/// ```
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn min<T: Ord>(v1: T, v2: T) -> T {
v1.min(v2)
Expand All @@ -935,6 +943,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
/// assert_eq!(cmp::min_by(-2, 2, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), -2);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "cmp_min_max_by", issue = "64460")]
pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
match compare(&v1, &v2) {
Expand All @@ -958,6 +967,7 @@ pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
/// assert_eq!(cmp::min_by_key(-2, 2, |x: &i32| x.abs()), -2);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "cmp_min_max_by", issue = "64460")]
pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
min_by(v1, v2, |v1, v2| f(v1).cmp(&f(v2)))
Expand All @@ -978,6 +988,7 @@ pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
/// assert_eq!(2, cmp::max(2, 2));
/// ```
#[inline]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn max<T: Ord>(v1: T, v2: T) -> T {
v1.max(v2)
Expand All @@ -998,6 +1009,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
/// assert_eq!(cmp::max_by(-2, 2, |x: &i32, y: &i32| x.abs().cmp(&y.abs())), 2);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "cmp_min_max_by", issue = "64460")]
pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
match compare(&v1, &v2) {
Expand All @@ -1021,6 +1033,7 @@ pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
/// assert_eq!(cmp::max_by_key(-2, 2, |x: &i32| x.abs()), 2);
/// ```
#[inline]
#[must_use]
#[unstable(feature = "cmp_min_max_by", issue = "64460")]
pub fn max_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
max_by(v1, v2, |v1, v2| f(v1).cmp(&f(v2)))
Expand Down
0