Skip to content

Commit

Permalink
Use prelude FromIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Mar 29, 2022
1 parent 99848ff commit ffd875b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use test::Bencher;
use indexmap::IndexMap;

use std::collections::HashMap;
use std::iter::FromIterator;

use rand::rngs::SmallRng;
use rand::seq::SliceRandom;
Expand Down
1 change: 0 additions & 1 deletion benches/faststring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use test::Bencher;
use indexmap::IndexMap;

use std::collections::HashMap;
use std::iter::FromIterator;

use rand::rngs::SmallRng;
use rand::seq::SliceRandom;
Expand Down
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::vec::{self, Vec};
use ::core::cmp::Ordering;
use ::core::fmt;
use ::core::hash::{BuildHasher, Hash, Hasher};
use ::core::iter::{FromIterator, FusedIterator};
use ::core::iter::FusedIterator;
use ::core::ops::{Index, IndexMut, RangeBounds};
use ::core::slice::{Iter as SliceIter, IterMut as SliceIterMut};

Expand Down Expand Up @@ -1406,7 +1406,7 @@ where
/// assert_eq!(map1, map2);
/// ```
fn from(arr: [(K, V); N]) -> Self {
std::array::IntoIter::new(arr).collect()
Self::from_iter(arr)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::vec::{self, Vec};
use core::cmp::Ordering;
use core::fmt;
use core::hash::{BuildHasher, Hash};
use core::iter::{Chain, FromIterator, FusedIterator};
use core::iter::{Chain, FusedIterator};
use core::ops::{BitAnd, BitOr, BitXor, Index, RangeBounds, Sub};
use core::slice;

Expand Down Expand Up @@ -903,7 +903,7 @@ where
/// assert_eq!(set1, set2);
/// ```
fn from(arr: [T; N]) -> Self {
std::array::IntoIter::new(arr).collect()
Self::from_iter(arr)
}
}

Expand Down
1 change: 0 additions & 1 deletion test-nostd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use core::hash::BuildHasherDefault;
use core::hash::Hasher;
use core::iter::FromIterator;

use indexmap::IndexMap;
use indexmap::IndexSet;
Expand Down
1 change: 0 additions & 1 deletion tests/quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt::Debug;
use std::hash::Hash;
use std::iter::FromIterator;
use std::ops::Bound;
use std::ops::Deref;

Expand Down

0 comments on commit ffd875b

Please sign in to comment.