Skip to content

Commit ec34d33

Browse files
committed
replace invocations of '.as_str()' with references
1 parent 965211e commit ec34d33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/shims/env.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tc
7979
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
8080
fn getenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, Scalar<Tag>> {
8181
let this = self.eval_context_mut();
82-
let target_os = this.tcx.sess.target.target.target_os.as_str();
82+
let target_os = &this.tcx.sess.target.target.target_os;
8383
assert!(target_os == "linux" || target_os == "macos", "`getenv` is only available for the UNIX target family");
8484

8585
let name_ptr = this.read_scalar(name_op)?.not_undef()?;
@@ -179,7 +179,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
179179
value_op: OpTy<'tcx, Tag>,
180180
) -> InterpResult<'tcx, i32> {
181181
let mut this = self.eval_context_mut();
182-
let target_os = this.tcx.sess.target.target.target_os.as_str();
182+
let target_os = &this.tcx.sess.target.target.target_os;
183183
assert!(target_os == "linux" || target_os == "macos", "`setenv` is only available for the UNIX target family");
184184

185185
let name_ptr = this.read_scalar(name_op)?.not_undef()?;
@@ -252,7 +252,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
252252

253253
fn unsetenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
254254
let this = self.eval_context_mut();
255-
let target_os = this.tcx.sess.target.target.target_os.as_str();
255+
let target_os = &this.tcx.sess.target.target.target_os;
256256
assert!(target_os == "linux" || target_os == "macos", "`unsetenv` is only available for the UNIX target family");
257257

258258
let name_ptr = this.read_scalar(name_op)?.not_undef()?;

0 commit comments

Comments
 (0)