@@ -113,6 +113,7 @@ pub struct VarsOs {
113
113
/// ```
114
114
///
115
115
/// [`env::vars_os()`]: vars_os
116
+ #[ must_use]
116
117
#[ stable( feature = "env" , since = "1.0.0" ) ]
117
118
pub fn vars ( ) -> Vars {
118
119
Vars { inner : vars_os ( ) }
@@ -140,6 +141,7 @@ pub fn vars() -> Vars {
140
141
/// println!("{:?}: {:?}", key, value);
141
142
/// }
142
143
/// ```
144
+ #[ must_use]
143
145
#[ stable( feature = "env" , since = "1.0.0" ) ]
144
146
pub fn vars_os ( ) -> VarsOs {
145
147
VarsOs { inner : os_imp:: env ( ) }
@@ -244,6 +246,7 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
244
246
/// None => println!("{} is not defined in the environment.", key)
245
247
/// }
246
248
/// ```
249
+ #[ must_use]
247
250
#[ stable( feature = "env" , since = "1.0.0" ) ]
248
251
pub fn var_os < K : AsRef < OsStr > > ( key : K ) -> Option < OsString > {
249
252
_var_os ( key. as_ref ( ) )
@@ -384,6 +387,7 @@ fn _remove_var(key: &OsStr) {
384
387
/// documentation for more.
385
388
///
386
389
/// [`env::split_paths()`]: split_paths
390
+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
387
391
#[ stable( feature = "env" , since = "1.0.0" ) ]
388
392
pub struct SplitPaths < ' a > {
389
393
inner : os_imp:: SplitPaths < ' a > ,
@@ -564,6 +568,7 @@ impl Error for JoinPathsError {
564
568
reason = "This function's behavior is unexpected and probably not what you want. \
565
569
Consider using a crate from crates.io instead."
566
570
) ]
571
+ #[ must_use]
567
572
#[ stable( feature = "env" , since = "1.0.0" ) ]
568
573
pub fn home_dir ( ) -> Option < PathBuf > {
569
574
os_imp:: home_dir ( )
@@ -603,6 +608,7 @@ pub fn home_dir() -> Option<PathBuf> {
603
608
/// println!("Temporary directory: {}", dir.display());
604
609
/// }
605
610
/// ```
611
+ #[ must_use]
606
612
#[ stable( feature = "env" , since = "1.0.0" ) ]
607
613
pub fn temp_dir ( ) -> PathBuf {
608
614
os_imp:: temp_dir ( )
@@ -690,6 +696,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
690
696
/// should not be relied upon for security purposes.
691
697
///
692
698
/// [`env::args()`]: args
699
+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
693
700
#[ stable( feature = "env" , since = "1.0.0" ) ]
694
701
pub struct Args {
695
702
inner : ArgsOs ,
@@ -706,6 +713,7 @@ pub struct Args {
706
713
/// should not be relied upon for security purposes.
707
714
///
708
715
/// [`env::args_os()`]: args_os
716
+ #[ must_use = "iterators are lazy and do nothing unless consumed" ]
709
717
#[ stable( feature = "env" , since = "1.0.0" ) ]
710
718
pub struct ArgsOs {
711
719
inner : sys:: args:: Args ,
0 commit comments