Skip to content

Commit 0d6bf1d

Browse files
committed
Fix warning
1 parent f2ead7b commit 0d6bf1d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

benches/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const FIXTURE: &str = include_str!("../cal.com.tsx");
99
fn criterion_benchmark(c: &mut Criterion) {
1010
c.bench_function("escape simd", |b| b.iter(|| black_box(encode_str(FIXTURE))));
1111
c.bench_function("escape v_jsonescape", |b| {
12-
b.iter(|| black_box(v_jsonescape::escape(FIXTURE)))
12+
b.iter(|| black_box(v_jsonescape::escape(FIXTURE).to_string()))
1313
});
1414
c.bench_function("escape software", |b| {
1515
b.iter(|| black_box(encode_str_fallback(FIXTURE)))

src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ mod avx2;
88

99
#[cfg(target_arch = "x86_64")]
1010
mod x86_64 {
11-
use super::*;
12-
1311
#[inline]
1412
pub fn encode_str<S: AsRef<str>>(input: S) -> String {
1513
// Runtime CPU feature detection for AVX2
1614
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
1715
{
1816
if is_x86_feature_detected!("avx2") {
19-
// Safe to use AVX2 implementation
20-
unsafe { return crate::avx2::encode_str(input) }
17+
return crate::avx2::encode_str(input);
2118
}
2219
}
2320

@@ -82,7 +79,6 @@ pub(crate) const HEX_BYTES: [(u8, u8); 256] = {
8279
bytes
8380
};
8481

85-
8682
#[macro_export]
8783
// We only use our own error type; no need for From conversions provided by the
8884
// standard library's try! macro. This reduces lines of LLVM IR by 4%.
@@ -160,7 +156,6 @@ pub fn encode_str<S: AsRef<str>>(input: S) -> String {
160156
encode_str_fallback(input)
161157
}
162158

163-
164159
#[test]
165160
fn test_escape_ascii_json_string() {
166161
let fixture = r#"abcdefghijklmnopqrstuvwxyz .*? hello world escape json string"#;

0 commit comments

Comments
 (0)