Skip to content

Commit 18ea4e4

Browse files
authored
style: use variables directly in format!() (#1432)
Prevent clippy warnings like: ``` error: variables can be used directly in the `format!` string --> benchmarks/benches/dataset.rs:40:47 | 40 | let mut group = criterion.benchmark_group(format!("dataset/{}", name)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args = note: `-D clippy::uninlined-format-args` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]` help: change this to | 40 - let mut group = criterion.benchmark_group(format!("dataset/{}", name)); 40 + let mut group = criterion.benchmark_group(format!("dataset/{name}")); | ```
1 parent 2821bd1 commit 18ea4e4

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

benchmarks/benches/dataset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn benchmark_dataset<M>(criterion: &mut Criterion, name: &str, dataset: &'static
3737
where
3838
M: prost::Message + Default + 'static,
3939
{
40-
let mut group = criterion.benchmark_group(format!("dataset/{}", name));
40+
let mut group = criterion.benchmark_group(format!("dataset/{name}"));
4141

4242
group.bench_function("merge", move |b| {
4343
let dataset = load_dataset(dataset).unwrap();

prost/benches/varint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rand::{rngs::StdRng, seq::SliceRandom, SeedableRng};
88
fn benchmark_varint(criterion: &mut Criterion, name: &str, mut values: Vec<u64>) {
99
// Shuffle the values in a stable order.
1010
values.shuffle(&mut StdRng::seed_from_u64(0));
11-
let name = format!("varint/{}", name);
11+
let name = format!("varint/{name}");
1212

1313
let encoded_len = values
1414
.iter()

protobuf/build.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ include(FetchContent)
6363
FetchContent_Declare(
6464
protobuf
6565
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
66-
GIT_TAG {tag}
66+
GIT_TAG {PROTOBUF_TAG}
6767
GIT_SHALLOW TRUE
6868
)
6969
@@ -73,7 +73,7 @@ set(ABSL_PROPAGATE_CXX_STD ON)
7373
set(ABSL_USE_EXTERNAL_GOOGLETEST ON)
7474
set(ABSL_BUILD_TESTING OFF)
7575
set(ABSL_ENABLE_INSTALL ON)
76-
set(protobuf_BUILD_CONFORMANCE {conformance})
76+
set(protobuf_BUILD_CONFORMANCE {build_conformance})
7777
set(protobuf_BUILD_TESTS OFF)
7878
set(protobuf_ABSL_PROVIDER "module")
7979
@@ -100,10 +100,7 @@ FetchContent_MakeAvailable(protobuf)
100100
if(_SAVED_APPLE)
101101
set(APPLE "${{_SAVED_APPLE}}" CACHE BOOL "" FORCE)
102102
endif()
103-
"#,
104-
system_processor = system_processor,
105-
tag = PROTOBUF_TAG,
106-
conformance = build_conformance
103+
"#
107104
);
108105

109106
fs::write(build_dir.join("CMakeLists.txt"), cmake_content)

0 commit comments

Comments
 (0)