You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/11/03 20:28:11 UTC
[avro] branch branch-1.11 updated: AVRO-3661: [Rust] Fix new clippy errors introduced with Rust 1.65 (#1941)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new 02e7a229c AVRO-3661: [Rust] Fix new clippy errors introduced with Rust 1.65 (#1941)
02e7a229c is described below
commit 02e7a229c7ac884de973792671e3d268ccaa0b20
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Thu Nov 3 21:27:16 2022 +0100
AVRO-3661: [Rust] Fix new clippy errors introduced with Rust 1.65 (#1941)
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
(cherry picked from commit a6b5879b5729c76224166f3e971a3b98f17a78b3)
---
lang/rust/avro/benches/serde.rs | 38 ++++++++++++------------------------
lang/rust/avro/benches/serde_json.rs | 2 +-
lang/rust/avro/src/encode.rs | 2 +-
lang/rust/avro/src/schema.rs | 2 +-
4 files changed, 16 insertions(+), 28 deletions(-)
diff --git a/lang/rust/avro/benches/serde.rs b/lang/rust/avro/benches/serde.rs
index fe82a18f2..141f7603b 100644
--- a/lang/rust/avro/benches/serde.rs
+++ b/lang/rust/avro/benches/serde.rs
@@ -231,23 +231,17 @@ fn bench_from_file(c: &mut Criterion, file_path: &str, name: &str) -> anyhow::Re
}
fn bench_small_schema_write_1_record(c: &mut Criterion) {
- bench_write(c, &make_small_record, 1, "small schema, write 1 record").unwrap();
+ bench_write(c, make_small_record, 1, "small schema, write 1 record").unwrap();
}
fn bench_small_schema_write_100_record(c: &mut Criterion) {
- bench_write(
- c,
- &make_small_record,
- 100,
- "small schema, write 100 records",
- )
- .unwrap();
+ bench_write(c, make_small_record, 100, "small schema, write 100 records").unwrap();
}
fn bench_small_schema_write_10_000_record(c: &mut Criterion) {
bench_write(
c,
- &make_small_record,
+ make_small_record,
10_000,
"small schema, write 10k records",
)
@@ -255,17 +249,17 @@ fn bench_small_schema_write_10_000_record(c: &mut Criterion) {
}
fn bench_small_schema_read_1_record(c: &mut Criterion) {
- bench_read(c, &make_small_record, 1, "small schema, read 1 record").unwrap();
+ bench_read(c, make_small_record, 1, "small schema, read 1 record").unwrap();
}
fn bench_small_schema_read_100_record(c: &mut Criterion) {
- bench_read(c, &make_small_record, 100, "small schema, read 100 records").unwrap();
+ bench_read(c, make_small_record, 100, "small schema, read 100 records").unwrap();
}
fn bench_small_schema_read_10_000_record(c: &mut Criterion) {
bench_read(
c,
- &make_small_record,
+ make_small_record,
10_000,
"small schema, read 10k records",
)
@@ -273,37 +267,31 @@ fn bench_small_schema_read_10_000_record(c: &mut Criterion) {
}
fn bench_big_schema_write_1_record(c: &mut Criterion) {
- bench_write(c, &make_big_record, 1, "big schema, write 1 record").unwrap();
+ bench_write(c, make_big_record, 1, "big schema, write 1 record").unwrap();
}
fn bench_big_schema_write_100_record(c: &mut Criterion) {
- bench_write(c, &make_big_record, 100, "big schema, write 100 records").unwrap();
+ bench_write(c, make_big_record, 100, "big schema, write 100 records").unwrap();
}
fn bench_big_schema_write_10_000_record(c: &mut Criterion) {
- bench_write(c, &make_big_record, 10_000, "big schema, write 10k records").unwrap();
+ bench_write(c, make_big_record, 10_000, "big schema, write 10k records").unwrap();
}
fn bench_big_schema_read_1_record(c: &mut Criterion) {
- bench_read(c, &make_big_record, 1, "big schema, read 1 record").unwrap();
+ bench_read(c, make_big_record, 1, "big schema, read 1 record").unwrap();
}
fn bench_big_schema_read_100_record(c: &mut Criterion) {
- bench_read(c, &make_big_record, 100, "big schema, read 100 records").unwrap();
+ bench_read(c, make_big_record, 100, "big schema, read 100 records").unwrap();
}
fn bench_big_schema_read_10_000_record(c: &mut Criterion) {
- bench_read(c, &make_big_record, 10_000, "big schema, read 10k records").unwrap();
+ bench_read(c, make_big_record, 10_000, "big schema, read 10k records").unwrap();
}
fn bench_big_schema_read_100_000_record(c: &mut Criterion) {
- bench_read(
- c,
- &make_big_record,
- 100_000,
- "big schema, read 100k records",
- )
- .unwrap();
+ bench_read(c, make_big_record, 100_000, "big schema, read 100k records").unwrap();
}
// This benchmark reads from the `benches/quickstop-null.avro` file, which was pulled from
diff --git a/lang/rust/avro/benches/serde_json.rs b/lang/rust/avro/benches/serde_json.rs
index 4cdbd8ccc..9a3a5dbfe 100644
--- a/lang/rust/avro/benches/serde_json.rs
+++ b/lang/rust/avro/benches/serde_json.rs
@@ -65,7 +65,7 @@ fn bench_read_json(
fn bench_big_schema_json_read_10_000_record(c: &mut Criterion) {
bench_read_json(
c,
- &make_big_json_record,
+ make_big_json_record,
10_000,
"big schema, read 10k JSON records",
);
diff --git a/lang/rust/avro/src/encode.rs b/lang/rust/avro/src/encode.rs
index 143c52542..ce98fc43b 100644
--- a/lang/rust/avro/src/encode.rs
+++ b/lang/rust/avro/src/encode.rs
@@ -68,7 +68,7 @@ pub(crate) fn encode_internal<S: Borrow<Schema>>(
match value {
Value::Null => (),
- Value::Boolean(b) => buffer.push(if *b { 1u8 } else { 0u8 }),
+ Value::Boolean(b) => buffer.push(u8::from(*b)),
// Pattern | Pattern here to signify that these _must_ have the same encoding.
Value::Int(i) | Value::Date(i) | Value::TimeMillis(i) => encode_int(*i, buffer),
Value::Long(i)
diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs
index 51ef7d96d..f1a729e88 100644
--- a/lang/rust/avro/src/schema.rs
+++ b/lang/rust/avro/src/schema.rs
@@ -1707,7 +1707,7 @@ fn pcf_map(schema: &Map<String, Value>) -> String {
_ => Cow::Borrowed(name),
};
- fields.push((k, format!("{}:{}", pcf_string(k), pcf_string(&*n))));
+ fields.push((k, format!("{}:{}", pcf_string(k), pcf_string(&n))));
continue;
}