@@ -288,6 +288,7 @@ where
288288/// documentation for more.
289289///
290290/// [`iter`]: BTreeMap::iter
291+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
291292#[ stable( feature = "rust1" , since = "1.0.0" ) ]
292293pub struct Iter < ' a , K : ' a , V : ' a > {
293294 range : LazyLeafRange < marker:: Immut < ' a > , K , V > ,
@@ -316,6 +317,7 @@ pub struct IterMut<'a, K: 'a, V: 'a> {
316317 _marker : PhantomData < & ' a mut ( K , V ) > ,
317318}
318319
320+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
319321#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
320322impl < K : fmt:: Debug , V : fmt:: Debug > fmt:: Debug for IterMut < ' _ , K , V > {
321323 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -359,6 +361,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IntoIter<K, V> {
359361/// documentation for more.
360362///
361363/// [`keys`]: BTreeMap::keys
364+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
362365#[ stable( feature = "rust1" , since = "1.0.0" ) ]
363366pub struct Keys < ' a , K : ' a , V : ' a > {
364367 inner : Iter < ' a , K , V > ,
@@ -377,6 +380,7 @@ impl<K: fmt::Debug, V> fmt::Debug for Keys<'_, K, V> {
377380/// documentation for more.
378381///
379382/// [`values`]: BTreeMap::values
383+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
380384#[ stable( feature = "rust1" , since = "1.0.0" ) ]
381385pub struct Values < ' a , K : ' a , V : ' a > {
382386 inner : Iter < ' a , K , V > ,
@@ -395,6 +399,7 @@ impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
395399/// documentation for more.
396400///
397401/// [`values_mut`]: BTreeMap::values_mut
402+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
398403#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
399404pub struct ValuesMut < ' a , K : ' a , V : ' a > {
400405 inner : IterMut < ' a , K , V > ,
@@ -413,6 +418,7 @@ impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
413418/// See its documentation for more.
414419///
415420/// [`into_keys`]: BTreeMap::into_keys
421+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
416422#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
417423pub struct IntoKeys < K , V > {
418424 inner : IntoIter < K , V > ,
@@ -431,6 +437,7 @@ impl<K: fmt::Debug, V> fmt::Debug for IntoKeys<K, V> {
431437/// See its documentation for more.
432438///
433439/// [`into_values`]: BTreeMap::into_values
440+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
434441#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
435442pub struct IntoValues < K , V > {
436443 inner : IntoIter < K , V > ,
@@ -449,6 +456,7 @@ impl<K, V: fmt::Debug> fmt::Debug for IntoValues<K, V> {
449456/// documentation for more.
450457///
451458/// [`range`]: BTreeMap::range
459+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
452460#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
453461pub struct Range < ' a , K : ' a , V : ' a > {
454462 inner : LeafRange < marker:: Immut < ' a > , K , V > ,
@@ -467,6 +475,7 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Range<'_, K, V> {
467475/// documentation for more.
468476///
469477/// [`range_mut`]: BTreeMap::range_mut
478+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
470479#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
471480pub struct RangeMut < ' a , K : ' a , V : ' a > {
472481 inner : LeafRange < marker:: ValMut < ' a > , K , V > ,
@@ -1265,7 +1274,6 @@ impl<K, V> BTreeMap<K, V> {
12651274 /// assert_eq!(keys, [1, 2]);
12661275 /// ```
12671276 #[ inline]
1268- #[ must_use = "`self` will be dropped if the result is not used" ]
12691277 #[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
12701278 pub fn into_keys ( self ) -> IntoKeys < K , V > {
12711279 IntoKeys { inner : self . into_iter ( ) }
@@ -1288,7 +1296,6 @@ impl<K, V> BTreeMap<K, V> {
12881296 /// assert_eq!(values, ["hello", "goodbye"]);
12891297 /// ```
12901298 #[ inline]
1291- #[ must_use = "`self` will be dropped if the result is not used" ]
12921299 #[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
12931300 pub fn into_values ( self ) -> IntoValues < K , V > {
12941301 IntoValues { inner : self . into_iter ( ) }
0 commit comments