Skip to content

Commit

Permalink
minor: fix clippy in nightly. (#5440)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener authored Mar 1, 2023
1 parent 3c1e4c0 commit f9f40bf
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions datafusion-cli/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub async fn exec_from_repl(
if let Err(e) =
command.execute(&mut print_options).await
{
eprintln!("{}", e)
eprintln!("{e}")
}
} else {
eprintln!(
Expand All @@ -126,7 +126,7 @@ pub async fn exec_from_repl(
}
_ => {
if let Err(e) = cmd.execute(ctx, &mut print_options).await {
eprintln!("{}", e)
eprintln!("{e}")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/src/object_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ mod tests {
let url = Url::from_str(s3).expect("Unable to parse s3 url");
let res = provider.get_by_url(&url);
let msg = match res {
Err(e) => format!("{}", e),
Err(e) => format!("{e}"),
Ok(_) => "".to_string(),
};
assert_eq!("".to_string(), msg); // Fail with error message
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2647,7 +2647,7 @@ impl TryFrom<&DataType> for ScalarValue {
macro_rules! format_option {
($F:expr, $EXPR:expr) => {{
match $EXPR {
Some(e) => write!($F, "{}", e),
Some(e) => write!($F, "{e}"),
None => write!($F, "NULL"),
}
}};
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_plan/file_format/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl ParquetExec {
match PruningPredicate::try_new(predicate_expr, file_schema.clone()) {
Ok(pruning_predicate) => Some(Arc::new(pruning_predicate)),
Err(e) => {
debug!("Could not create pruning predicate for: {}", e);
debug!("Could not create pruning predicate for: {e}");
predicate_creation_errors.add(1);
None
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ fn prune_pages_in_one_row_group(
// stats filter array could not be built
// return a result which will not filter out any pages
Err(e) => {
debug!("Error evaluating page index predicate values {}", e);
debug!("Error evaluating page index predicate values {e}");
metrics.predicate_evaluation_errors.add(1);
return Ok(vec![RowSelector::select(group.num_rows() as usize)]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(crate) fn prune_row_groups(
// stats filter array could not be built
// return a closure which will not filter out any row groups
Err(e) => {
debug!("Error evaluating row group predicate values {}", e);
debug!("Error evaluating row group predicate values {e}");
metrics.predicate_evaluation_errors.add(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,7 @@ mod tests {
let result = expr.evaluate(batch).unwrap().into_array(batch.num_rows());
assert!(
result == expected_result.clone(),
"result: {:?} != expected result: {:?}",
result,
expected_result
"result: {result:?} != expected result: {expected_result:?}"
);
assert_eq!(result.data_type(), &DataType::Float64);
}
Expand Down
16 changes: 6 additions & 10 deletions datafusion/proto/src/bytes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ pub fn logical_plan_to_json(plan: &LogicalPlan) -> Result<String> {
let extension_codec = DefaultLogicalExtensionCodec {};
let protobuf =
protobuf::LogicalPlanNode::try_from_logical_plan(plan, &extension_codec)
.map_err(|e| {
DataFusionError::Plan(format!("Error serializing plan: {}", e))
})?;
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))?;
serde_json::to_string(&protobuf)
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {}", e)))
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))
}

/// Serialize a LogicalPlan as bytes, using the provided extension codec
Expand All @@ -185,7 +183,7 @@ pub fn logical_plan_to_bytes_with_extension_codec(
#[cfg(feature = "json")]
pub fn logical_plan_from_json(json: &str, ctx: &SessionContext) -> Result<LogicalPlan> {
let back: protobuf::LogicalPlanNode = serde_json::from_str(json)
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {}", e)))?;
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))?;
let extension_codec = DefaultLogicalExtensionCodec {};
back.try_into_logical_plan(ctx, &extension_codec)
}
Expand Down Expand Up @@ -223,11 +221,9 @@ pub fn physical_plan_to_json(plan: Arc<dyn ExecutionPlan>) -> Result<String> {
let extension_codec = DefaultPhysicalExtensionCodec {};
let protobuf =
protobuf::PhysicalPlanNode::try_from_physical_plan(plan, &extension_codec)
.map_err(|e| {
DataFusionError::Plan(format!("Error serializing plan: {}", e))
})?;
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))?;
serde_json::to_string(&protobuf)
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {}", e)))
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))
}

/// Serialize a PhysicalPlan as bytes, using the provided extension codec
Expand All @@ -251,7 +247,7 @@ pub fn physical_plan_from_json(
ctx: &SessionContext,
) -> Result<Arc<dyn ExecutionPlan>> {
let back: protobuf::PhysicalPlanNode = serde_json::from_str(json)
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {}", e)))?;
.map_err(|e| DataFusionError::Plan(format!("Error serializing plan: {e}")))?;
let extension_codec = DefaultPhysicalExtensionCodec {};
back.try_into_physical_plan(ctx, &ctx.runtime_env(), &extension_codec)
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/row/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ pub(crate) fn write_field_date32(
) {
match as_date32_array(from) {
Ok(from) => to.set_date32(col_idx, from.value(row_idx)),
Err(e) => panic!("{}", e),
Err(e) => panic!("{e}"),
};
}

Expand Down

0 comments on commit f9f40bf

Please sign in to comment.