From 1228c9d39b08c5eef0dfc4e1ff6bf6160f95793c Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Wed, 20 Sep 2023 19:06:47 +0800 Subject: [PATCH] clippy Signed-off-by: Bugen Zhao --- Cargo.lock | 1 + src/expr/src/expr/expr_case.rs | 4 ++-- src/expr/src/expr/expr_coalesce.rs | 5 ++--- src/expr/src/expr/expr_field.rs | 6 ++---- src/expr/src/expr/expr_in.rs | 4 ++-- src/expr/src/expr/expr_input_ref.rs | 5 ++--- src/expr/src/expr/expr_literal.rs | 2 -- src/expr/src/expr/expr_some_all.rs | 4 ++-- src/expr/src/expr/expr_udf.rs | 4 ++-- src/expr/src/expr/mod.rs | 1 - src/prost/build.rs | 5 ++++- src/workspace-hack/Cargo.toml | 1 + 12 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 52bd8c9442b5e..8278d3b2733db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10350,6 +10350,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", + "strum 0.25.0", "subtle", "syn 1.0.109", "syn 2.0.33", diff --git a/src/expr/src/expr/expr_case.rs b/src/expr/src/expr/expr_case.rs index e07350d8c3898..dc95b1647d165 100644 --- a/src/expr/src/expr/expr_case.rs +++ b/src/expr/src/expr/expr_case.rs @@ -22,8 +22,8 @@ use risingwave_pb::expr::expr_node::{PbType, RexNode}; use risingwave_pb::expr::ExprNode; use super::Build; -use crate::expr::{build_from_prost, BoxedExpression, Expression}; -use crate::{ExprError, Result}; +use crate::expr::{BoxedExpression, Expression}; +use crate::Result; #[derive(Debug)] pub struct WhenClause { diff --git a/src/expr/src/expr/expr_coalesce.rs b/src/expr/src/expr/expr_coalesce.rs index 37f3ba57a61c6..71c7392c7ec37 100644 --- a/src/expr/src/expr/expr_coalesce.rs +++ b/src/expr/src/expr/expr_coalesce.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; use std::ops::BitAnd; use std::sync::Arc; @@ -23,8 +22,8 @@ use risingwave_pb::expr::expr_node::{RexNode, Type}; use risingwave_pb::expr::ExprNode; use super::Build; -use crate::expr::{build_from_prost as expr_build_from_prost, BoxedExpression, Expression}; -use crate::{bail, ensure, ExprError, Result}; +use crate::expr::{BoxedExpression, Expression}; +use crate::{bail, ensure, Result}; #[derive(Debug)] pub struct CoalesceExpression { diff --git a/src/expr/src/expr/expr_field.rs b/src/expr/src/expr/expr_field.rs index 2506b5f241f6a..eb4183edd2f57 100644 --- a/src/expr/src/expr/expr_field.rs +++ b/src/expr/src/expr/expr_field.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use anyhow::anyhow; use risingwave_common::array::{ArrayImpl, ArrayRef, DataChunk}; use risingwave_common::row::OwnedRow; @@ -23,8 +21,8 @@ use risingwave_pb::expr::expr_node::{RexNode, Type}; use risingwave_pb::expr::ExprNode; use super::Build; -use crate::expr::{build_from_prost as expr_build_from_prost, BoxedExpression, Expression}; -use crate::{bail, ensure, ExprError, Result}; +use crate::expr::{BoxedExpression, Expression}; +use crate::{bail, ensure, Result}; /// `FieldExpression` access a field from a struct. #[derive(Debug)] diff --git a/src/expr/src/expr/expr_in.rs b/src/expr/src/expr/expr_in.rs index 8453c326e74f7..f599bd4a64e42 100644 --- a/src/expr/src/expr/expr_in.rs +++ b/src/expr/src/expr/expr_in.rs @@ -26,8 +26,8 @@ use risingwave_pb::expr::expr_node::{RexNode, Type}; use risingwave_pb::expr::ExprNode; use super::Build; -use crate::expr::{build_from_prost, BoxedExpression, Expression}; -use crate::{ExprError, Result}; +use crate::expr::{BoxedExpression, Expression}; +use crate::Result; #[derive(Debug)] pub struct InExpression { diff --git a/src/expr/src/expr/expr_input_ref.rs b/src/expr/src/expr/expr_input_ref.rs index e551726a4599d..d3da5a89894e3 100644 --- a/src/expr/src/expr/expr_input_ref.rs +++ b/src/expr/src/expr/expr_input_ref.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; use std::ops::Index; use risingwave_common::array::{ArrayRef, DataChunk}; @@ -20,9 +19,9 @@ use risingwave_common::row::OwnedRow; use risingwave_common::types::{DataType, Datum}; use risingwave_pb::expr::ExprNode; -use super::{Build, BoxedExpression}; +use super::{BoxedExpression, Build}; use crate::expr::Expression; -use crate::{ExprError, Result}; +use crate::Result; /// A reference to a column in input relation. #[derive(Debug, Clone)] diff --git a/src/expr/src/expr/expr_literal.rs b/src/expr/src/expr/expr_literal.rs index 89c5cc32c555c..4009fc346cc41 100644 --- a/src/expr/src/expr/expr_literal.rs +++ b/src/expr/src/expr/expr_literal.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::convert::TryFrom; - use risingwave_common::array::DataChunk; use risingwave_common::row::OwnedRow; use risingwave_common::types::{literal_type_match, DataType, Datum}; diff --git a/src/expr/src/expr/expr_some_all.rs b/src/expr/src/expr/expr_some_all.rs index 9cf69d799f6cf..8978824bef0bc 100644 --- a/src/expr/src/expr/expr_some_all.rs +++ b/src/expr/src/expr/expr_some_all.rs @@ -24,8 +24,8 @@ use risingwave_pb::expr::expr_node::{RexNode, Type}; use risingwave_pb::expr::{ExprNode, FunctionCall}; use super::build::get_children_and_return_type; -use super::{build_from_prost, BoxedExpression, Build, Expression}; -use crate::{ExprError, Result}; +use super::{BoxedExpression, Build, Expression}; +use crate::Result; #[derive(Debug)] pub struct SomeAllExpression { diff --git a/src/expr/src/expr/expr_udf.rs b/src/expr/src/expr/expr_udf.rs index 7a4b63cc88497..54c49317b748f 100644 --- a/src/expr/src/expr/expr_udf.rs +++ b/src/expr/src/expr/expr_udf.rs @@ -25,9 +25,9 @@ use risingwave_common::types::{DataType, Datum}; use risingwave_pb::expr::ExprNode; use risingwave_udf::ArrowFlightUdfClient; -use super::{build_from_prost, BoxedExpression, Build, InputRefExpression}; +use super::{BoxedExpression, Build}; use crate::expr::Expression; -use crate::{bail, ExprError, Result}; +use crate::{bail, Result}; #[derive(Debug)] pub struct UdfExpression { diff --git a/src/expr/src/expr/mod.rs b/src/expr/src/expr/mod.rs index ded7e376cc675..c30cd38ae6cf0 100644 --- a/src/expr/src/expr/mod.rs +++ b/src/expr/src/expr/mod.rs @@ -55,7 +55,6 @@ use futures_util::TryFutureExt; use risingwave_common::array::{ArrayRef, DataChunk}; use risingwave_common::row::OwnedRow; use risingwave_common::types::{DataType, Datum}; -use risingwave_pb::expr::PbExprNode; pub use self::build::*; pub use self::expr_input_ref::InputRefExpression; diff --git a/src/prost/build.rs b/src/prost/build.rs index 5ed9e200eac71..71e813796e504 100644 --- a/src/prost/build.rs +++ b/src/prost/build.rs @@ -72,7 +72,10 @@ fn main() -> Result<(), Box> { .compile_well_known_types(true) .protoc_arg("--experimental_allow_proto3_optional") .type_attribute(".", "#[derive(prost_helpers::AnyPB)]") - .type_attribute("node_body", "#[derive(::enum_as_inner::EnumAsInner, ::strum::Display)]") + .type_attribute( + "node_body", + "#[derive(::enum_as_inner::EnumAsInner, ::strum::Display)]", + ) .type_attribute("rex_node", "#[derive(::enum_as_inner::EnumAsInner)]") .type_attribute( "meta.PausedReason", diff --git a/src/workspace-hack/Cargo.toml b/src/workspace-hack/Cargo.toml index acbc053ff9983..72a2509ef1259 100644 --- a/src/workspace-hack/Cargo.toml +++ b/src/workspace-hack/Cargo.toml @@ -108,6 +108,7 @@ sqlx-core = { version = "0.7", features = ["_rt-tokio", "any", "chrono", "json", sqlx-mysql = { version = "0.7", default-features = false, features = ["any", "chrono", "json", "migrate", "offline"] } sqlx-postgres = { version = "0.7", default-features = false, features = ["any", "chrono", "json", "migrate", "offline"] } sqlx-sqlite = { version = "0.7", default-features = false, features = ["any", "chrono", "json", "migrate", "offline"] } +strum = { version = "0.25", features = ["derive"] } subtle = { version = "2" } time = { version = "0.3", features = ["local-offset", "macros", "serde-well-known"] } tinyvec = { version = "1", features = ["alloc", "grab_spare_slice", "rustc_1_55"] }