Skip to content

Commit c1366b5

Browse files
emilkclaude
andauthored
chore: apply workspace lints to all crates (apache#24076)
## Which issue does this PR close? - Part of apache#18467 - Broken out of apache#24066 - Sibling PR: apache/arrow-rs#10533 ## Rationale for this change The workspace already has a `[workspace.lints]` table, but it was missing from three crates ## What changes are included in this PR? Inheriting the workspace lints in all crates, and fixing the resulting violations ## Are these changes tested? Yes, by existing tests and CI ## Are there any user-facing changes? No --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
1 parent d813358 commit c1366b5

16 files changed

Lines changed: 82 additions & 83 deletions

File tree

‎Cargo.toml‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,20 +209,21 @@ url = "2.5.7"
209209
uuid = "1.23"
210210
zstd = { version = "0.13", default-features = false }
211211

212+
# Keep this list sorted alphabetically.
212213
[workspace.lints.clippy]
214+
# https://github.com/apache/datafusion/issues/18881
215+
allow_attributes = "warn"
216+
assigning_clones = "warn"
217+
inefficient_to_string = "warn"
213218
# Detects large stack-allocated futures that may cause stack overflow crashes (see threshold in clippy.toml)
214219
large_futures = "warn"
215-
used_underscore_binding = "warn"
216-
or_fun_call = "warn"
217-
unnecessary_lazy_evaluations = "warn"
218-
uninlined_format_args = "warn"
219-
inefficient_to_string = "warn"
220220
# https://github.com/apache/datafusion/issues/18503
221221
needless_pass_by_value = "warn"
222-
# https://github.com/apache/datafusion/issues/18881
223-
allow_attributes = "warn"
224-
assigning_clones = "warn"
222+
or_fun_call = "warn"
223+
uninlined_format_args = "warn"
224+
unnecessary_lazy_evaluations = "warn"
225225
unused_async = "warn"
226+
used_underscore_binding = "warn"
226227

227228
[workspace.lints.rust]
228229
unexpected_cfgs = { level = "warn", check-cfg = [

‎datafusion/proto-common/Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ rust-version = { workspace = true }
3131
[package.metadata.docs.rs]
3232
all-features = true
3333

34+
# Note: add additional linter rules in lib.rs.
35+
# Rust does not support workspace + new linter rules in subcrates yet
36+
# https://github.com/rust-lang/cargo/issues/13157
37+
[lints]
38+
workspace = true
39+
3440
[lib]
3541
name = "datafusion_proto_common"
3642

‎datafusion/proto-common/src/from_proto/mod.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,9 +1259,7 @@ fn vec_to_array<T, const N: usize>(v: Vec<T>) -> [T; N] {
12591259
}
12601260

12611261
/// Converts a vector of `protobuf::Field`s to `Arc<arrow::Field>`s.
1262-
pub fn parse_proto_fields_to_fields<'a, I>(
1263-
fields: I,
1264-
) -> std::result::Result<Vec<Field>, Error>
1262+
pub fn parse_proto_fields_to_fields<'a, I>(fields: I) -> Result<Vec<Field>, Error>
12651263
where
12661264
I: IntoIterator<Item = &'a protobuf::Field>,
12671265
{

‎datafusion/proto-common/src/generated/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// This code is generated so we don't want to fix any lint violations manually
1919
#[allow(clippy::allow_attributes)]
2020
#[allow(clippy::all)]
21+
#[allow(unused_qualifications)]
2122
#[rustfmt::skip]
2223
pub mod datafusion_proto_common {
2324
include!("prost.rs");

‎datafusion/proto-common/src/to_proto/mod.rs‎

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl TryFrom<&DataType> for protobuf::ArrowType {
115115
}
116116
}
117117

118-
impl TryFrom<&DataType> for protobuf::arrow_type::ArrowTypeEnum {
118+
impl TryFrom<&DataType> for ArrowTypeEnum {
119119
type Error = Error;
120120

121121
fn try_from(val: &DataType) -> Result<Self, Self::Error> {
@@ -439,9 +439,7 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
439439
})
440440
}
441441
None => Ok(protobuf::ScalarValue {
442-
value: Some(protobuf::scalar_value::Value::NullValue(
443-
(&data_type).try_into()?,
444-
)),
442+
value: Some(Value::NullValue((&data_type).try_into()?)),
445443
}),
446444
},
447445
ScalarValue::Decimal64(val, p, s) => match *val {
@@ -457,9 +455,7 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
457455
})
458456
}
459457
None => Ok(protobuf::ScalarValue {
460-
value: Some(protobuf::scalar_value::Value::NullValue(
461-
(&data_type).try_into()?,
462-
)),
458+
value: Some(Value::NullValue((&data_type).try_into()?)),
463459
}),
464460
},
465461
ScalarValue::Decimal128(val, p, s) => match *val {
@@ -475,9 +471,7 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
475471
})
476472
}
477473
None => Ok(protobuf::ScalarValue {
478-
value: Some(protobuf::scalar_value::Value::NullValue(
479-
(&data_type).try_into()?,
480-
)),
474+
value: Some(Value::NullValue((&data_type).try_into()?)),
481475
}),
482476
},
483477
ScalarValue::Decimal256(val, p, s) => match *val {
@@ -493,9 +487,7 @@ impl TryFrom<&ScalarValue> for protobuf::ScalarValue {
493487
})
494488
}
495489
None => Ok(protobuf::ScalarValue {
496-
value: Some(protobuf::scalar_value::Value::NullValue(
497-
(&data_type).try_into()?,
498-
)),
490+
value: Some(Value::NullValue((&data_type).try_into()?)),
499491
}),
500492
},
501493
ScalarValue::Date64(val) => {
@@ -788,8 +780,8 @@ impl From<&Precision<usize>> for protobuf::Precision {
788780
}
789781
}
790782

791-
impl From<&Precision<datafusion_common::ScalarValue>> for protobuf::Precision {
792-
fn from(s: &Precision<datafusion_common::ScalarValue>) -> protobuf::Precision {
783+
impl From<&Precision<ScalarValue>> for protobuf::Precision {
784+
fn from(s: &Precision<ScalarValue>) -> protobuf::Precision {
793785
match s {
794786
Precision::Exact(val) => protobuf::Precision {
795787
precision_info: protobuf::PrecisionInfo::Exact.into(),
@@ -1076,16 +1068,14 @@ impl TryFrom<&JsonOptions> for protobuf::JsonOptions {
10761068

10771069
/// Creates a scalar protobuf value from an optional value (T), and
10781070
/// encoding None as the appropriate datatype
1079-
fn create_proto_scalar<I, T: FnOnce(&I) -> protobuf::scalar_value::Value>(
1071+
fn create_proto_scalar<I, T: FnOnce(&I) -> Value>(
10801072
v: Option<&I>,
10811073
null_arrow_type: &DataType,
10821074
constructor: T,
10831075
) -> Result<protobuf::ScalarValue, Error> {
10841076
let value = v
10851077
.map(constructor)
1086-
.unwrap_or(protobuf::scalar_value::Value::NullValue(
1087-
null_arrow_type.try_into()?,
1088-
));
1078+
.unwrap_or(Value::NullValue(null_arrow_type.try_into()?));
10891079

10901080
Ok(protobuf::ScalarValue { value: Some(value) })
10911081
}
@@ -1141,35 +1131,25 @@ fn encode_scalar_nested_value(
11411131

11421132
match val {
11431133
ScalarValue::List(_) => Ok(protobuf::ScalarValue {
1144-
value: Some(protobuf::scalar_value::Value::ListValue(scalar_list_value)),
1134+
value: Some(Value::ListValue(scalar_list_value)),
11451135
}),
11461136
ScalarValue::LargeList(_) => Ok(protobuf::ScalarValue {
1147-
value: Some(protobuf::scalar_value::Value::LargeListValue(
1148-
scalar_list_value,
1149-
)),
1137+
value: Some(Value::LargeListValue(scalar_list_value)),
11501138
}),
11511139
ScalarValue::FixedSizeList(_) => Ok(protobuf::ScalarValue {
1152-
value: Some(protobuf::scalar_value::Value::FixedSizeListValue(
1153-
scalar_list_value,
1154-
)),
1140+
value: Some(Value::FixedSizeListValue(scalar_list_value)),
11551141
}),
11561142
ScalarValue::ListView(_) => Ok(protobuf::ScalarValue {
1157-
value: Some(protobuf::scalar_value::Value::ListViewValue(
1158-
scalar_list_value,
1159-
)),
1143+
value: Some(Value::ListViewValue(scalar_list_value)),
11601144
}),
11611145
ScalarValue::LargeListView(_) => Ok(protobuf::ScalarValue {
1162-
value: Some(protobuf::scalar_value::Value::LargeListViewValue(
1163-
scalar_list_value,
1164-
)),
1146+
value: Some(Value::LargeListViewValue(scalar_list_value)),
11651147
}),
11661148
ScalarValue::Struct(_) => Ok(protobuf::ScalarValue {
1167-
value: Some(protobuf::scalar_value::Value::StructValue(
1168-
scalar_list_value,
1169-
)),
1149+
value: Some(Value::StructValue(scalar_list_value)),
11701150
}),
11711151
ScalarValue::Map(_) => Ok(protobuf::ScalarValue {
1172-
value: Some(protobuf::scalar_value::Value::MapValue(scalar_list_value)),
1152+
value: Some(Value::MapValue(scalar_list_value)),
11731153
}),
11741154
_ => unreachable!(),
11751155
}

‎datafusion/proto-models/Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ rust-version = { workspace = true }
3131
[package.metadata.docs.rs]
3232
all-features = true
3333

34+
# Note: add additional linter rules in lib.rs.
35+
# Rust does not support workspace + new linter rules in subcrates yet
36+
# https://github.com/rust-lang/cargo/issues/13157
37+
[lints]
38+
workspace = true
39+
3440
[lib]
3541
name = "datafusion_proto_models"
3642

‎datafusion/proto-models/src/generated/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// This code is generated so we don't want to fix any lint violations manually
1919
#[allow(clippy::allow_attributes)]
2020
#[allow(clippy::all)]
21+
#[allow(unused_qualifications)]
2122
#[rustfmt::skip]
2223
pub mod datafusion {
2324
include!("prost.rs");

‎datafusion/proto/Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ rust-version = { workspace = true }
3131
[package.metadata.docs.rs]
3232
all-features = true
3333

34+
# Note: add additional linter rules in lib.rs.
35+
# Rust does not support workspace + new linter rules in subcrates yet
36+
# https://github.com/rust-lang/cargo/issues/13157
37+
[lints]
38+
workspace = true
39+
3440
[lib]
3541
name = "datafusion_proto"
3642

‎datafusion/proto/src/bytes/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ pub fn physical_plan_to_bytes_with_extension_codec(
213213

214214
/// Serialize a PhysicalPlan as bytes, using the provided extension codec
215215
/// and protobuf converter.
216+
#[expect(clippy::needless_pass_by_value)] // Taking the plan by value is part of the public API
216217
pub fn physical_plan_to_bytes_with_proto_converter(
217218
plan: Arc<dyn ExecutionPlan>,
218219
extension_codec: &dyn PhysicalExtensionCodec,

‎datafusion/proto/src/convert.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ pub trait FromProto<T>: Sized {
4040
/// versa). Mirrors [`TryFrom`].
4141
pub trait TryFromProto<T>: Sized {
4242
type Error;
43-
fn try_from_proto(value: T) -> std::result::Result<Self, Self::Error>;
43+
fn try_from_proto(value: T) -> Result<Self, Self::Error>;
4444
}

0 commit comments

Comments
 (0)