Skip to content

Commit

Permalink
Auto merge of #58828 - Centril:deny-elided_lifetimes_in_paths-libstd,…
Browse files Browse the repository at this point in the history
… r=oli-obk

libstd: deny(elided_lifetimes_in_paths)

r? @oli-obk
  • Loading branch information
bors committed Mar 15, 2019
2 parents 52e8856 + 6b1e200 commit 547c074
Show file tree
Hide file tree
Showing 85 changed files with 381 additions and 377 deletions.
54 changes: 27 additions & 27 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ fn search_hashed_nonempty_mut<K, V, M, F>(table: M, hash: SafeHash, mut is_match
}
}

fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>)
fn pop_internal<K, V>(starting_bucket: FullBucketMut<'_, K, V>)
-> (K, V, &mut RawTable<K, V>)
{
let (empty, retkey, retval) = starting_bucket.take();
Expand Down Expand Up @@ -759,7 +759,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn keys(&self) -> Keys<K, V> {
pub fn keys(&self) -> Keys<'_, K, V> {
Keys { inner: self.iter() }
}

Expand All @@ -781,7 +781,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn values(&self) -> Values<K, V> {
pub fn values(&self) -> Values<'_, K, V> {
Values { inner: self.iter() }
}

Expand All @@ -808,7 +808,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "map_values_mut", since = "1.10.0")]
pub fn values_mut(&mut self) -> ValuesMut<K, V> {
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
ValuesMut { inner: self.iter_mut() }
}

Expand All @@ -830,7 +830,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter { inner: self.table.iter() }
}

Expand Down Expand Up @@ -858,7 +858,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> {
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut { inner: self.table.iter_mut() }
}

Expand Down Expand Up @@ -918,7 +918,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// ```
#[inline]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<K, V> {
pub fn drain(&mut self) -> Drain<'_, K, V> {
Drain { inner: self.table.drain() }
}

Expand Down Expand Up @@ -1270,7 +1270,7 @@ impl<K, V, S> HashMap<K, V, S>
/// assert_eq!(letters.get(&'y'), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn entry(&mut self, key: K) -> Entry<K, V> {
pub fn entry(&mut self, key: K) -> Entry<'_, K, V> {
// Gotta resize now.
self.reserve(1);
let hash = self.make_hash(&key);
Expand Down Expand Up @@ -1571,7 +1571,7 @@ impl<K, V, S> HashMap<K, V, S>
/// are free to assume this doesn't happen (within the limits of memory-safety).
#[inline(always)]
#[unstable(feature = "hash_raw_entry", issue = "56167")]
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<K, V, S> {
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S> {
self.reserve(1);
RawEntryBuilderMut { map: self }
}
Expand All @@ -1592,7 +1592,7 @@ impl<K, V, S> HashMap<K, V, S>
///
/// Immutable raw entries have very limited use; you might instead want `raw_entry_mut`.
#[unstable(feature = "hash_raw_entry", issue = "56167")]
pub fn raw_entry(&self) -> RawEntryBuilder<K, V, S> {
pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S> {
RawEntryBuilder { map: self }
}
}
Expand Down Expand Up @@ -1626,7 +1626,7 @@ impl<K, V, S> Debug for HashMap<K, V, S>
V: Debug,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_map().entries(self.iter()).finish()
}
}
Expand Down Expand Up @@ -1683,7 +1683,7 @@ impl<K, V> Clone for Iter<'_, K, V> {

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V: Debug> fmt::Debug for Iter<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
Expand Down Expand Up @@ -1736,7 +1736,7 @@ impl<K, V> Clone for Keys<'_, K, V> {

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V> fmt::Debug for Keys<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
Expand Down Expand Up @@ -1765,7 +1765,7 @@ impl<K, V> Clone for Values<'_, K, V> {

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K, V: Debug> fmt::Debug for Values<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
Expand Down Expand Up @@ -2244,15 +2244,15 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {

#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder")
.finish()
}
}

#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
RawEntryMut::Vacant(ref v) => {
f.debug_tuple("RawEntry")
Expand All @@ -2270,7 +2270,7 @@ impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'_, K, V, S> {

#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawOccupiedEntryMut")
.field("key", self.key())
.field("value", self.get())
Expand All @@ -2280,15 +2280,15 @@ impl<K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'_, K, V> {

#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawVacantEntryMut")
.finish()
}
}

#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder")
.finish()
}
Expand All @@ -2315,7 +2315,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {

#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for Entry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Vacant(ref v) => {
f.debug_tuple("Entry")
Expand Down Expand Up @@ -2348,7 +2348,7 @@ unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for OccupiedEntry<'a, K, V> {}

#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry")
.field("key", self.key())
.field("value", self.get())
Expand All @@ -2374,7 +2374,7 @@ unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for VacantEntry<'a, K, V> {}

#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V> Debug for VacantEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("VacantEntry")
.field(self.key())
.finish()
Expand Down Expand Up @@ -2489,7 +2489,7 @@ impl<K, V> fmt::Debug for IterMut<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
Expand Down Expand Up @@ -2521,7 +2521,7 @@ impl<K, V> FusedIterator for IntoIter<K, V> {}

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V: Debug> fmt::Debug for IntoIter<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
Expand Down Expand Up @@ -2602,7 +2602,7 @@ impl<K, V> fmt::Debug for ValuesMut<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.inner.iter())
.finish()
Expand Down Expand Up @@ -2637,7 +2637,7 @@ impl<K, V> fmt::Debug for Drain<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
Expand Down Expand Up @@ -3257,7 +3257,7 @@ impl Default for RandomState {

#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for RandomState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("RandomState { .. }")
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl<T, S> HashSet<T, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.map.keys() }
}

Expand Down Expand Up @@ -239,7 +239,7 @@ impl<T, S> HashSet<T, S> {
/// ```
#[inline]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> {
pub fn drain(&mut self) -> Drain<'_, T> {
Drain { iter: self.map.drain() }
}

Expand Down Expand Up @@ -801,7 +801,7 @@ impl<T, S> fmt::Debug for HashSet<T, S>
where T: Eq + Hash + fmt::Debug,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_set().entries(self.iter()).finish()
}
}
Expand Down Expand Up @@ -1135,7 +1135,7 @@ impl<K> FusedIterator for Iter<'_, K> {}

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for Iter<'_, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
Expand All @@ -1162,7 +1162,7 @@ impl<K> FusedIterator for IntoIter<K> {}

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for IntoIter<K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let entries_iter = self.iter
.inner
.iter()
Expand Down Expand Up @@ -1193,7 +1193,7 @@ impl<K> FusedIterator for Drain<'_, K> {}

#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for Drain<'_, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let entries_iter = self.iter
.inner
.iter()
Expand Down Expand Up @@ -1236,7 +1236,7 @@ impl<T, S> fmt::Debug for Intersection<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
Expand Down Expand Up @@ -1289,7 +1289,7 @@ impl<T, S> fmt::Debug for Difference<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
Expand Down Expand Up @@ -1328,7 +1328,7 @@ impl<T, S> fmt::Debug for SymmetricDifference<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
Expand All @@ -1352,7 +1352,7 @@ impl<T, S> fmt::Debug for Union<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/libstd/collections/hash/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,21 +772,21 @@ impl<K, V> RawTable<K, V> {
self.size
}

fn raw_buckets(&self) -> RawBuckets<K, V> {
fn raw_buckets(&self) -> RawBuckets<'_, K, V> {
RawBuckets {
raw: self.raw_bucket_at(0),
elems_left: self.size,
marker: marker::PhantomData,
}
}

pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.raw_buckets(),
}
}

pub fn iter_mut(&mut self) -> IterMut<K, V> {
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut {
iter: self.raw_buckets(),
_marker: marker::PhantomData,
Expand All @@ -806,7 +806,7 @@ impl<K, V> RawTable<K, V> {
}
}

pub fn drain(&mut self) -> Drain<K, V> {
pub fn drain(&mut self) -> Drain<'_, K, V> {
let RawBuckets { raw, elems_left, .. } = self.raw_buckets();
// Replace the marker regardless of lifetime bounds on parameters.
Drain {
Expand Down Expand Up @@ -936,7 +936,7 @@ unsafe impl<K: Sync, V: Sync> Sync for IterMut<'_, K, V> {}
unsafe impl<K: Send, V: Send> Send for IterMut<'_, K, V> {}

impl<'a, K: 'a, V: 'a> IterMut<'a, K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}
Expand All @@ -953,7 +953,7 @@ unsafe impl<K: Sync, V: Sync> Sync for IntoIter<K, V> {}
unsafe impl<K: Send, V: Send> Send for IntoIter<K, V> {}

impl<K, V> IntoIter<K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}
Expand All @@ -971,7 +971,7 @@ unsafe impl<K: Sync, V: Sync> Sync for Drain<'_, K, V> {}
unsafe impl<K: Send, V: Send> Send for Drain<'_, K, V> {}

impl<'a, K, V> Drain<'a, K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}
Expand Down
Loading

0 comments on commit 547c074

Please sign in to comment.