File tree 2 files changed +4
-6
lines changed
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 1
1
//! Platform-dependent environment variables abstraction.
2
2
3
- #![ deny ( unsafe_op_in_unsafe_fn) ]
3
+ #![ forbid ( unsafe_op_in_unsafe_fn) ]
4
4
5
5
cfg_if:: cfg_if! {
6
6
if #[ cfg( target_family = "unix" ) ] {
Original file line number Diff line number Diff line change 1
- #![ allow( unsafe_op_in_unsafe_fn) ]
2
-
3
1
use core:: slice:: memchr;
4
2
5
3
use libc:: c_char;
@@ -81,7 +79,7 @@ impl Iterator for Env {
81
79
// desirable anyhow? Though it also means that we have to link to Foundation.
82
80
#[ cfg( target_vendor = "apple" ) ]
83
81
pub unsafe fn environ ( ) -> * mut * const * const c_char {
84
- libc:: _NSGetEnviron ( ) as * mut * const * const c_char
82
+ unsafe { libc:: _NSGetEnviron ( ) as * mut * const * const c_char }
85
83
}
86
84
87
85
// Use the `environ` static which is part of POSIX.
@@ -159,14 +157,14 @@ pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
159
157
run_with_cstr ( k. as_bytes ( ) , & |k| {
160
158
run_with_cstr ( v. as_bytes ( ) , & |v| {
161
159
let _guard = ENV_LOCK . write ( ) ;
162
- cvt ( libc:: setenv ( k. as_ptr ( ) , v. as_ptr ( ) , 1 ) ) . map ( drop)
160
+ cvt ( unsafe { libc:: setenv ( k. as_ptr ( ) , v. as_ptr ( ) , 1 ) } ) . map ( drop)
163
161
} )
164
162
} )
165
163
}
166
164
167
165
pub unsafe fn unsetenv ( n : & OsStr ) -> io:: Result < ( ) > {
168
166
run_with_cstr ( n. as_bytes ( ) , & |nbuf| {
169
167
let _guard = ENV_LOCK . write ( ) ;
170
- cvt ( libc:: unsetenv ( nbuf. as_ptr ( ) ) ) . map ( drop)
168
+ cvt ( unsafe { libc:: unsetenv ( nbuf. as_ptr ( ) ) } ) . map ( drop)
171
169
} )
172
170
}
You can’t perform that action at this time.
0 commit comments