diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-09 19:43:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-09 19:43:25 -0500 |
| commit | 3199b2478a26d5a53fac25ee16f7c9c4ccc69d9b (patch) | |
| tree | 7e4568a6ad9e53a1d013f796fbe21184cf872a99 /src/libcore | |
| parent | af1ddb9ec583df5dfda727df45de332f65e79521 (diff) | |
| parent | e626a6807c44d097996b0f32a4e03b105837f9da (diff) | |
| download | rust-3199b2478a26d5a53fac25ee16f7c9c4ccc69d9b.tar.gz rust-3199b2478a26d5a53fac25ee16f7c9c4ccc69d9b.zip | |
Rollup merge of #39705 - tspiteri:name-trait-fn-params, r=aturon
name anonymous fn parameters in libcore traits This follows the discussion in rust-lang/rfcs#1685. The patch gives names to anonymous parameters in libcore traits. It would have two benefits I can think of: firstly it would provide names to tools that can use the names from the traits, and secondly core/std can serve as an example when writing traits; this change helps by not encouraging the use of anonymous parameters.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 18 | ||||
| -rw-r--r-- | src/libcore/ops.rs | 20 | ||||
| -rw-r--r-- | src/libcore/str/pattern.rs | 6 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index eb086c20181..6c48c29ecd1 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -434,7 +434,7 @@ impl<'a> Display for Arguments<'a> { pub trait Debug { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for an empty format, `{}`. @@ -477,7 +477,7 @@ pub trait Debug { pub trait Display { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `o` character. @@ -524,7 +524,7 @@ pub trait Display { pub trait Octal { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `b` character. @@ -571,7 +571,7 @@ pub trait Octal { pub trait Binary { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `x` character. @@ -619,7 +619,7 @@ pub trait Binary { pub trait LowerHex { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `X` character. @@ -667,7 +667,7 @@ pub trait LowerHex { pub trait UpperHex { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `p` character. @@ -712,7 +712,7 @@ pub trait UpperHex { pub trait Pointer { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `e` character. @@ -755,7 +755,7 @@ pub trait Pointer { pub trait LowerExp { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// Format trait for the `E` character. @@ -798,7 +798,7 @@ pub trait LowerExp { pub trait UpperExp { /// Formats the value using the given formatter. #[stable(feature = "rust1", since = "1.0.0")] - fn fmt(&self, &mut Formatter) -> Result; + fn fmt(&self, f: &mut Formatter) -> Result; } /// The `write` function takes an output stream, a precompiled format string, diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 566fb89365a..59bcb340ec9 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1324,7 +1324,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize } pub trait AddAssign<Rhs=Self> { /// The method for the `+=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn add_assign(&mut self, Rhs); + fn add_assign(&mut self, rhs: Rhs); } macro_rules! add_assign_impl { @@ -1380,7 +1380,7 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } pub trait SubAssign<Rhs=Self> { /// The method for the `-=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn sub_assign(&mut self, Rhs); + fn sub_assign(&mut self, rhs: Rhs); } macro_rules! sub_assign_impl { @@ -1425,7 +1425,7 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } pub trait MulAssign<Rhs=Self> { /// The method for the `*=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn mul_assign(&mut self, Rhs); + fn mul_assign(&mut self, rhs: Rhs); } macro_rules! mul_assign_impl { @@ -1470,7 +1470,7 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } pub trait DivAssign<Rhs=Self> { /// The method for the `/=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn div_assign(&mut self, Rhs); + fn div_assign(&mut self, rhs: Rhs); } macro_rules! div_assign_impl { @@ -1514,7 +1514,7 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } pub trait RemAssign<Rhs=Self> { /// The method for the `%=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn rem_assign(&mut self, Rhs); + fn rem_assign(&mut self, rhs: Rhs); } macro_rules! rem_assign_impl { @@ -1600,7 +1600,7 @@ rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } pub trait BitAndAssign<Rhs=Self> { /// The method for the `&=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn bitand_assign(&mut self, Rhs); + fn bitand_assign(&mut self, rhs: Rhs); } macro_rules! bitand_assign_impl { @@ -1644,7 +1644,7 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } pub trait BitOrAssign<Rhs=Self> { /// The method for the `|=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn bitor_assign(&mut self, Rhs); + fn bitor_assign(&mut self, rhs: Rhs); } macro_rules! bitor_assign_impl { @@ -1688,7 +1688,7 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } pub trait BitXorAssign<Rhs=Self> { /// The method for the `^=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn bitxor_assign(&mut self, Rhs); + fn bitxor_assign(&mut self, rhs: Rhs); } macro_rules! bitxor_assign_impl { @@ -1732,7 +1732,7 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } pub trait ShlAssign<Rhs> { /// The method for the `<<=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn shl_assign(&mut self, Rhs); + fn shl_assign(&mut self, rhs: Rhs); } macro_rules! shl_assign_impl { @@ -1797,7 +1797,7 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize } pub trait ShrAssign<Rhs=Self> { /// The method for the `>>=` operator #[stable(feature = "op_assign_traits", since = "1.8.0")] - fn shr_assign(&mut self, Rhs); + fn shr_assign(&mut self, rhs: Rhs); } macro_rules! shr_assign_impl { diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 7dced2ba751..8493afe98bc 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -240,7 +240,7 @@ pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> {} #[doc(hidden)] trait CharEq { - fn matches(&mut self, char) -> bool; + fn matches(&mut self, c: char) -> bool; fn only_ascii(&self) -> bool; } @@ -1178,8 +1178,8 @@ impl TwoWaySearcher { trait TwoWayStrategy { type Output; fn use_early_reject() -> bool; - fn rejecting(usize, usize) -> Self::Output; - fn matching(usize, usize) -> Self::Output; + fn rejecting(a: usize, b: usize) -> Self::Output; + fn matching(a: usize, b: usize) -> Self::Output; } /// Skip to match intervals as quickly as possible |
