Skip to content

Commit 9d3f1bb

Browse files
committed
chore(CI) Update workspace / CI to Rust 1.87
1 parent 3e30f77 commit 9d3f1bb

File tree

15 files changed

+42
-50
lines changed

15 files changed

+42
-50
lines changed

datafusion-examples/examples/flight/flight_sql_server.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ impl FlightSqlServiceImpl {
115115
Ok(uuid)
116116
}
117117

118+
#[allow(clippy::result_large_err)]
118119
fn get_ctx<T>(&self, req: &Request<T>) -> Result<Arc<SessionContext>, Status> {
119120
// get the token from the authorization header on Request
120121
let auth = req
@@ -140,6 +141,7 @@ impl FlightSqlServiceImpl {
140141
}
141142
}
142143

144+
#[allow(clippy::result_large_err)]
143145
fn get_plan(&self, handle: &str) -> Result<LogicalPlan, Status> {
144146
if let Some(plan) = self.statements.get(handle) {
145147
Ok(plan.clone())
@@ -148,6 +150,7 @@ impl FlightSqlServiceImpl {
148150
}
149151
}
150152

153+
#[allow(clippy::result_large_err)]
151154
fn get_result(&self, handle: &str) -> Result<Vec<RecordBatch>, Status> {
152155
if let Some(result) = self.results.get(handle) {
153156
Ok(result.clone())
@@ -195,11 +198,13 @@ impl FlightSqlServiceImpl {
195198
.unwrap()
196199
}
197200

201+
#[allow(clippy::result_large_err)]
198202
fn remove_plan(&self, handle: &str) -> Result<(), Status> {
199203
self.statements.remove(&handle.to_string());
200204
Ok(())
201205
}
202206

207+
#[allow(clippy::result_large_err)]
203208
fn remove_result(&self, handle: &str) -> Result<(), Status> {
204209
self.results.remove(&handle.to_string());
205210
Ok(())

datafusion/common/src/error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl Error for DataFusionError {
397397

398398
impl From<DataFusionError> for io::Error {
399399
fn from(e: DataFusionError) -> Self {
400-
io::Error::new(io::ErrorKind::Other, e)
400+
io::Error::other(e)
401401
}
402402
}
403403

@@ -1120,8 +1120,7 @@ mod test {
11201120
);
11211121

11221122
// assert wrapping other Error
1123-
let generic_error: GenericError =
1124-
Box::new(std::io::Error::new(std::io::ErrorKind::Other, "io error"));
1123+
let generic_error: GenericError = Box::new(std::io::Error::other("io error"));
11251124
let datafusion_error: DataFusionError = generic_error.into();
11261125
println!("{}", datafusion_error.strip_backtrace());
11271126
assert_eq!(
@@ -1132,8 +1131,7 @@ mod test {
11321131

11331132
#[test]
11341133
fn external_error_no_recursive() {
1135-
let generic_error_1: GenericError =
1136-
Box::new(std::io::Error::new(std::io::ErrorKind::Other, "io error"));
1134+
let generic_error_1: GenericError = Box::new(std::io::Error::other("io error"));
11371135
let external_error_1: DataFusionError = generic_error_1.into();
11381136
let generic_error_2: GenericError = Box::new(external_error_1);
11391137
let external_error_2: DataFusionError = generic_error_2.into();

datafusion/common/src/stats.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ impl Statistics {
352352
return self;
353353
};
354354

355+
#[allow(clippy::large_enum_variant)]
355356
enum Slot {
356357
/// The column is taken and put into the specified statistics location
357358
Taken(usize),

datafusion/datasource-avro/src/avro_to_arrow/arrow_array_reader.rs

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use apache_avro::schema::RecordSchema;
2121
use apache_avro::{
2222
schema::{Schema as AvroSchema, SchemaKind},
2323
types::Value,
24-
AvroResult, Error as AvroError, Reader as AvroReader,
24+
Error as AvroError, Reader as AvroReader,
2525
};
2626
use arrow::array::{
2727
make_array, Array, ArrayBuilder, ArrayData, ArrayDataBuilder, ArrayRef,
@@ -938,40 +938,31 @@ fn resolve_string(v: &Value) -> ArrowResult<Option<String>> {
938938
.map_err(|e| SchemaError(format!("expected resolvable string : {e:?}")))
939939
}
940940

941-
fn resolve_u8(v: &Value) -> AvroResult<u8> {
942-
let int = match v {
943-
Value::Int(n) => Ok(Value::Int(*n)),
944-
Value::Long(n) => Ok(Value::Int(*n as i32)),
945-
other => Err(AvroError::GetU8(other.into())),
946-
}?;
947-
if let Value::Int(n) = int {
948-
if n >= 0 && n <= From::from(u8::MAX) {
949-
return Ok(n as u8);
950-
}
951-
}
941+
fn resolve_u8(v: &Value) -> Option<u8> {
942+
let v = match v {
943+
Value::Union(_, inner) => inner.as_ref(),
944+
_ => v,
945+
};
952946

953-
Err(AvroError::GetU8(int.into()))
947+
match v {
948+
Value::Int(n) => u8::try_from(*n).ok(),
949+
Value::Long(n) => u8::try_from(*n).ok(),
950+
_ => None,
951+
}
954952
}
955953

956954
fn resolve_bytes(v: &Value) -> Option<Vec<u8>> {
957-
let v = if let Value::Union(_, b) = v { b } else { v };
955+
let v = match v {
956+
Value::Union(_, inner) => inner.as_ref(),
957+
_ => v,
958+
};
959+
958960
match v {
959-
Value::Bytes(_) => Ok(v.clone()),
960-
Value::String(s) => Ok(Value::Bytes(s.clone().into_bytes())),
961-
Value::Array(items) => Ok(Value::Bytes(
962-
items
963-
.iter()
964-
.map(resolve_u8)
965-
.collect::<Result<Vec<_>, _>>()
966-
.ok()?,
967-
)),
968-
other => Err(AvroError::GetBytes(other.into())),
969-
}
970-
.ok()
971-
.and_then(|v| match v {
972-
Value::Bytes(s) => Some(s),
961+
Value::Bytes(bytes) => Some(bytes.clone()),
962+
Value::String(s) => Some(s.as_bytes().to_vec()),
963+
Value::Array(items) => items.iter().map(resolve_u8).collect::<Option<Vec<u8>>>(),
973964
_ => None,
974-
})
965+
}
975966
}
976967

977968
fn resolve_fixed(v: &Value, size: usize) -> Option<Vec<u8>> {

datafusion/expr-common/src/accumulator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use std::fmt::Debug;
4242
/// [`state`] and combine the state from multiple accumulators
4343
/// via [`merge_batch`], as part of efficient multi-phase grouping.
4444
///
45-
/// [`GroupsAccumulator`]: crate::GroupsAccumulator
4645
/// [`update_batch`]: Self::update_batch
4746
/// [`retract_batch`]: Self::retract_batch
4847
/// [`state`]: Self::state

datafusion/expr/src/planner.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ pub struct RawWindowExpr {
312312

313313
/// Result of planning a raw expr with [`ExprPlanner`]
314314
#[derive(Debug, Clone)]
315+
#[allow(clippy::large_enum_variant)]
315316
pub enum PlannerResult<T> {
316317
/// The raw expression was successfully planned as a new [`Expr`]
317318
Planned(Expr),

datafusion/expr/src/simplify.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl SimplifyInfo for SimplifyContext<'_> {
110110

111111
/// Was the expression simplified?
112112
#[derive(Debug)]
113+
#[allow(clippy::large_enum_variant)]
113114
pub enum ExprSimplifyResult {
114115
/// The function call was simplified to an entirely new Expr
115116
Simplified(Expr),

datafusion/expr/src/window_state.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,7 @@ impl WindowFrameContext {
193193
// UNBOUNDED PRECEDING
194194
WindowFrameBound::Preceding(ScalarValue::UInt64(None)) => 0,
195195
WindowFrameBound::Preceding(ScalarValue::UInt64(Some(n))) => {
196-
if idx >= n as usize {
197-
idx - n as usize
198-
} else {
199-
0
200-
}
196+
idx.saturating_sub(n as usize)
201197
}
202198
WindowFrameBound::CurrentRow => idx,
203199
// UNBOUNDED FOLLOWING
@@ -602,11 +598,7 @@ impl WindowFrameStateGroups {
602598

603599
// Find the group index of the frame boundary:
604600
let group_idx = if SEARCH_SIDE {
605-
if self.current_group_idx > delta {
606-
self.current_group_idx - delta
607-
} else {
608-
0
609-
}
601+
self.current_group_idx.saturating_sub(delta)
610602
} else {
611603
self.current_group_idx + delta
612604
};

datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ struct ConstEvaluator<'a> {
520520

521521
#[allow(dead_code)]
522522
/// The simplify result of ConstEvaluator
523+
#[allow(clippy::large_enum_variant)]
523524
enum ConstSimplifyResult {
524525
// Expr was simplified and contains the new expression
525526
Simplified(ScalarValue),

datafusion/physical-plan/src/aggregates/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ impl PartialEq for PhysicalGroupBy {
346346
}
347347
}
348348

349+
#[allow(clippy::large_enum_variant)]
349350
enum StreamType {
350351
AggregateStream(AggregateStream),
351352
GroupedHash(GroupedHashAggregateStream),

datafusion/sql/src/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl Visitor for RelationVisitor {
7878
if !with.recursive {
7979
// This is a bit hackish as the CTE will be visited again as part of visiting `q`,
8080
// but thankfully `insert_relation` is idempotent.
81-
cte.visit(self);
81+
let _ = cte.visit(self);
8282
}
8383
self.ctes_in_scope
8484
.push(ObjectName::from(vec![cte.alias.name.clone()]));
@@ -143,7 +143,7 @@ fn visit_statement(statement: &DFStatement, visitor: &mut RelationVisitor) {
143143
visitor.insert_relation(table_name);
144144
}
145145
CopyToSource::Query(query) => {
146-
query.visit(visitor);
146+
let _ = query.visit(visitor);
147147
}
148148
},
149149
DFStatement::Explain(explain) => visit_statement(&explain.statement, visitor),

datafusion/sql/src/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
885885
| SelectItem::UnnamedExpr(expr) = proj
886886
{
887887
let mut err = None;
888-
visit_expressions_mut(expr, |expr| {
888+
let _ = visit_expressions_mut(expr, |expr| {
889889
if let SQLExpr::Function(f) = expr {
890890
if let Some(WindowType::NamedWindow(ident)) = &f.over {
891891
let normalized_ident =

datafusion/sql/src/unparser/ast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl SelectBuilder {
213213
value: &ast::Expr,
214214
) -> &mut Self {
215215
if let Some(selection) = &mut self.selection {
216-
visit_expressions_mut(selection, |expr| {
216+
let _ = visit_expressions_mut(selection, |expr| {
217217
if expr == existing_expr {
218218
*expr = value.clone();
219219
}
@@ -398,6 +398,7 @@ pub struct RelationBuilder {
398398

399399
#[allow(dead_code)]
400400
#[derive(Clone)]
401+
#[allow(clippy::large_enum_variant)]
401402
enum TableFactorBuilder {
402403
Table(TableRelationBuilder),
403404
Derived(DerivedRelationBuilder),

datafusion/sql/src/unparser/extension_unparser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub enum UnparseWithinStatementResult {
6464
}
6565

6666
/// The result of unparsing a custom logical node to a statement.
67+
#[allow(clippy::large_enum_variant)]
6768
pub enum UnparseToStatementResult {
6869
/// If the custom logical node was successfully unparsed to a statement.
6970
Modified(Statement),

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
# to compile this workspace and run CI jobs.
2020

2121
[toolchain]
22-
channel = "1.86.0"
22+
channel = "1.87.0"
2323
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)