mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 19:04:21 +00:00

It warns about usages of `std::env::{set_var, remove_var}` with an automatic fix wrapping the call in an `unsafe` block.
21 lines
448 B
Rust
21 lines
448 B
Rust
//@ run-rustfix
|
|
|
|
#![deny(deprecated_safe)]
|
|
|
|
use std::env;
|
|
|
|
#[deny(unused_unsafe)]
|
|
fn main() {
|
|
env::set_var("FOO", "BAR");
|
|
//~^ ERROR call to deprecated safe function
|
|
//~| WARN this is accepted in the current edition
|
|
env::remove_var("FOO");
|
|
//~^ ERROR call to deprecated safe function
|
|
//~| WARN this is accepted in the current edition
|
|
|
|
unsafe {
|
|
env::set_var("FOO", "BAR");
|
|
env::remove_var("FOO");
|
|
}
|
|
}
|