Skip to content

Commit 0702139

Browse files
committed
Auto merge of #13329 - ehuss:fix-static_mut_ref, r=weihanglo
Fix static_mut_ref warning. The nightly compiler has recently added the [`static_mut_ref`](https://doc.rust-lang.org/nightly/rustc/lints/listing/warn-by-default.html#static-mut-ref) lint, which warns about taking a reference to a `mut static`. This fixes the issue by copying the value instead of taking a reference. I don't recall what I was thinking when I wrote this, but it was probably a bad reflex against making copies.
2 parents c22cc7b + 3c414b5 commit 0702139

File tree

1 file changed

+2
-2
lines changed
  • crates/cargo-test-macro/src

1 file changed

+2
-2
lines changed

crates/cargo-test-macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn to_token_stream(code: &str) -> TokenStream {
187187

188188
static mut VERSION: (u32, bool) = (0, false);
189189

190-
fn version() -> &'static (u32, bool) {
190+
fn version() -> (u32, bool) {
191191
static INIT: Once = Once::new();
192192
INIT.call_once(|| {
193193
let output = Command::new("rustc")
@@ -201,7 +201,7 @@ fn version() -> &'static (u32, bool) {
201201
let minor = vers.split('.').skip(1).next().unwrap().parse().unwrap();
202202
unsafe { VERSION = (minor, is_nightly) }
203203
});
204-
unsafe { &VERSION }
204+
unsafe { VERSION }
205205
}
206206

207207
fn has_command(command: &str) -> bool {

0 commit comments

Comments
 (0)