Skip to content

Commit 187aea7

Browse files
committed
Impl Default for ranges
1 parent 2835224 commit 187aea7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/libcore/ops/range.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::hash::Hash;
3939
/// [`Iterator`]: ../iter/trait.IntoIterator.html
4040
/// [slicing index]: ../slice/trait.SliceIndex.html
4141
#[doc(alias = "..")]
42-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
42+
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash)]
4343
#[stable(feature = "rust1", since = "1.0.0")]
4444
pub struct RangeFull;
4545

@@ -71,7 +71,7 @@ impl fmt::Debug for RangeFull {
7171
/// assert_eq!(arr[1..=3], [ 1,2,3 ]);
7272
/// ```
7373
#[doc(alias = "..")]
74-
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
74+
#[derive(Clone, Default, PartialEq, Eq, Hash)] // not Copy -- see #27186
7575
#[stable(feature = "rust1", since = "1.0.0")]
7676
pub struct Range<Idx> {
7777
/// The lower bound of the range (inclusive).
@@ -179,7 +179,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
179179
///
180180
/// [`Iterator`]: ../iter/trait.IntoIterator.html
181181
#[doc(alias = "..")]
182-
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
182+
#[derive(Clone, Default, PartialEq, Eq, Hash)] // not Copy -- see #27186
183183
#[stable(feature = "rust1", since = "1.0.0")]
184184
pub struct RangeFrom<Idx> {
185185
/// The lower bound of the range (inclusive).
@@ -261,7 +261,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
261261
/// [`Iterator`]: ../iter/trait.IntoIterator.html
262262
/// [slicing index]: ../slice/trait.SliceIndex.html
263263
#[doc(alias = "..")]
264-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
264+
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash)]
265265
#[stable(feature = "rust1", since = "1.0.0")]
266266
pub struct RangeTo<Idx> {
267267
/// The upper bound of the range (exclusive).
@@ -329,7 +329,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
329329
/// assert_eq!(arr[1..=3], [ 1,2,3 ]); // RangeInclusive
330330
/// ```
331331
#[doc(alias = "..=")]
332-
#[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186
332+
#[derive(Clone, Default, PartialEq, Eq, Hash)] // not Copy -- see #27186
333333
#[stable(feature = "inclusive_range", since = "1.26.0")]
334334
pub struct RangeInclusive<Idx> {
335335
// Note that the fields here are not public to allow changing the
@@ -556,7 +556,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
556556
/// [`Iterator`]: ../iter/trait.IntoIterator.html
557557
/// [slicing index]: ../slice/trait.SliceIndex.html
558558
#[doc(alias = "..=")]
559-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
559+
#[derive(Copy, Clone, Default, PartialEq, Eq, Hash)]
560560
#[stable(feature = "inclusive_range", since = "1.26.0")]
561561
pub struct RangeToInclusive<Idx> {
562562
/// The upper bound of the range (inclusive)

0 commit comments

Comments
 (0)