Skip to content

Commit

Permalink
Mute warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stepancheg committed Oct 2, 2023
1 parent 0470560 commit 4620a1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
6 changes: 3 additions & 3 deletions test-crates/perftest/misc/src/bin/read_varint.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::env;
use std::hint;
use std::process;
use std::time::Instant;

use protobuf::CodedInputStream;
use protobuf::CodedOutputStream;
use protobuf_perftest_misc::black_box;

fn main() {
let args: Vec<String> = env::args().skip(1).collect();
Expand Down Expand Up @@ -42,9 +42,9 @@ fn main() {
if i % br == 0 {
eprintln!("{}", i / br);
}
let mut is = CodedInputStream::from_bytes(black_box(&data));
let mut is = CodedInputStream::from_bytes(hint::black_box(&data));
while !is.eof().unwrap() {
black_box(is.read_raw_varint64().unwrap());
hint::black_box(is.read_raw_varint64().unwrap());
}
}

Expand Down
14 changes: 0 additions & 14 deletions test-crates/perftest/misc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
// Feature name changed
#![cfg_attr(rustc_nightly, feature(bench_black_box))]
#![cfg_attr(rustc_nightly, feature(test))]

#[cfg(not(rustc_nightly))]
#[inline(never)]
pub fn black_box<T>(v: T) -> T {
v
}

#[cfg(rustc_nightly)]
#[inline(always)]
pub fn black_box<T>(v: T) -> T {
std::hint::black_box(v)
}

0 comments on commit 4620a1e

Please sign in to comment.