Skip to content

Commit 5bd7dc8

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

File tree

13 files changed

+38
-45
lines changed

13 files changed

+38
-45
lines changed

datafusion/common/src/error.rs

Lines changed: 1 addition & 1 deletion
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

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: 23 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,34 @@ 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(), // &Box<Value> -> &Value
944+
_ => v,
945+
};
952946

953-
Err(AvroError::GetU8(int.into()))
947+
match v {
948+
Value::Int(n) if (0..=u8::MAX as i32).contains(n) => Some(*n as u8),
949+
Value::Long(n) if (0..=u8::MAX as i64).contains(n) => Some(*n as u8),
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) => {
964+
let bytes: Option<Vec<u8>> = items.iter().map(resolve_u8).collect();
965+
bytes
966+
}
973967
_ => None,
974-
})
968+
}
975969
}
976970

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

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)