diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b05a9f899a906..44635cc714594 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2022-11-14" -components = ["rustfmt", "clippy", "rust-src"] +channel = "nightly-2022-12-15" +components = ["rustfmt", "clippy", "rust-src", "miri"] diff --git a/src/binaries/meta/main.rs b/src/binaries/meta/main.rs index 14bb6a3a6f5dd..6ffaf543cef99 100644 --- a/src/binaries/meta/main.rs +++ b/src/binaries/meta/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + use std::env; use std::ops::Deref; use std::sync::Arc; diff --git a/src/binaries/metabench/main.rs b/src/binaries/metabench/main.rs index 242df95b3ea43..c42f037bcc035 100644 --- a/src/binaries/metabench/main.rs +++ b/src/binaries/metabench/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + use std::fmt::Debug; use std::fmt::Display; use std::sync::Arc; diff --git a/src/binaries/metactl/main.rs b/src/binaries/metactl/main.rs index 78d1fc69e9715..b27977e09619d 100644 --- a/src/binaries/metactl/main.rs +++ b/src/binaries/metactl/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod grpc; use grpc::export_meta; diff --git a/src/binaries/query/main.rs b/src/binaries/query/main.rs index 8135e86edc451..d95e1e65d014e 100644 --- a/src/binaries/query/main.rs +++ b/src/binaries/query/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod local; use std::env; diff --git a/src/common/auth/src/lib.rs b/src/common/auth/src/lib.rs index b58abd6ee457f..c37c40e860544 100644 --- a/src/common/auth/src/lib.rs +++ b/src/common/auth/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod auth; pub use auth::RefreshableToken; pub use auth::TokenFile; diff --git a/src/common/base/src/lib.rs b/src/common/base/src/lib.rs index 6c9bc43b52a34..be26b3d8a4b34 100644 --- a/src/common/base/src/lib.rs +++ b/src/common/base/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] +#![allow(incomplete_features)] #![feature(allocator_api)] #![feature(thread_local)] #![feature(ptr_metadata)] @@ -19,7 +21,6 @@ #![feature(try_trait_v2)] #![feature(thread_id_value)] #![feature(backtrace_frames)] -#![allow(incomplete_features)] #![feature(alloc_error_hook)] pub mod base; diff --git a/src/common/building/src/lib.rs b/src/common/building/src/lib.rs index 1d484e9154305..c39338dbbe176 100644 --- a/src/common/building/src/lib.rs +++ b/src/common/building/src/lib.rs @@ -13,6 +13,7 @@ // limitations under the License. #![deny(unused_crate_dependencies)] +#![allow(clippy::uninlined_format_args)] mod git; diff --git a/src/common/cache/src/lib.rs b/src/common/cache/src/lib.rs index 4fe3c6ab9fbcc..920d9cbdf6221 100644 --- a/src/common/cache/src/lib.rs +++ b/src/common/cache/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #[cfg(feature = "heapsize")] #[cfg(not(target_os = "macos"))] extern crate heapsize_; diff --git a/src/common/cache/tests/it/main.rs b/src/common/cache/tests/it/main.rs index cb6566a4926db..0f9ba048238f0 100644 --- a/src/common/cache/tests/it/main.rs +++ b/src/common/cache/tests/it/main.rs @@ -12,4 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod cache; diff --git a/src/common/exception/src/lib.rs b/src/common/exception/src/lib.rs index df3aaf5ad7791..b917de888e314 100644 --- a/src/common/exception/src/lib.rs +++ b/src/common/exception/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] pub mod exception; mod exception_code; mod exception_flight; diff --git a/src/common/grpc/src/lib.rs b/src/common/grpc/src/lib.rs index 5102307a8fe3b..6b99dba778961 100644 --- a/src/common/grpc/src/lib.rs +++ b/src/common/grpc/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub use client_conf::RpcClientConf; pub use client_conf::RpcClientTlsConfig; pub use dns_resolver::ConnectionFactory; diff --git a/src/common/http/src/lib.rs b/src/common/http/src/lib.rs index c9654ad0f247d..a085ec339201b 100644 --- a/src/common/http/src/lib.rs +++ b/src/common/http/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod debug; mod health; mod http_shutdown_handlers; diff --git a/src/common/io/src/cursor_ext/cursor_read_datetime_ext.rs b/src/common/io/src/cursor_ext/cursor_read_datetime_ext.rs index 61fbc131599b6..120278ac8cb3a 100644 --- a/src/common/io/src/cursor_ext/cursor_read_datetime_ext.rs +++ b/src/common/io/src/cursor_ext/cursor_read_datetime_ext.rs @@ -116,7 +116,7 @@ where T: AsRef<[u8]> let mut times = Vec::with_capacity(3); loop { buf.clear(); - let size = self.keep_read(&mut buf, |f| (b'0'..=b'9').contains(&f)); + let size = self.keep_read(&mut buf, |f| f.is_ascii_digit()); if size == 0 { break; } else { @@ -145,7 +145,7 @@ where T: AsRef<[u8]> // ms .microseconds let dt = if self.ignore_byte(b'.') { buf.clear(); - let size = self.keep_read(&mut buf, |f| (b'0'..=b'9').contains(&f)); + let size = self.keep_read(&mut buf, |f| f.is_ascii_digit()); if size == 0 { return Err(ErrorCode::BadBytes( "err with parse micros second, format like this:[.123456]", @@ -215,7 +215,7 @@ where T: AsRef<[u8]> west_tz: bool, calc_offset: impl Fn(i64, i64, &DateTime) -> Result>, ) -> Result> { - let n = self.keep_read(buf, |f| (b'0'..=b'9').contains(&f)); + let n = self.keep_read(buf, |f| f.is_ascii_digit()); if n != 2 { // +0800 will err in there return Err(ErrorCode::BadBytes( @@ -226,7 +226,7 @@ where T: AsRef<[u8]> if (0..15).contains(&hour_offset) { buf.clear(); self.ignore_byte(b':'); - if self.keep_read(buf, |f| (b'0'..=b'9').contains(&f)) != 2 { + if self.keep_read(buf, |f| f.is_ascii_digit()) != 2 { // +08[other byte]00 will err in there, e.g. +08-00 return Err(ErrorCode::BadBytes( "err with parse timezone, format like this:[+08:00]", diff --git a/src/common/io/src/cursor_ext/cursor_read_number_ext.rs b/src/common/io/src/cursor_ext/cursor_read_number_ext.rs index 4161617c3b3f2..00ee169adfbe2 100644 --- a/src/common/io/src/cursor_ext/cursor_read_number_ext.rs +++ b/src/common/io/src/cursor_ext/cursor_read_number_ext.rs @@ -55,7 +55,7 @@ pub fn collect_number(buffer: &[u8]) -> (usize, usize) { index += 1; } if point_pos < len { - while index < len && (b'0'..=b'9').contains(&buffer[index]) { + while index < len && buffer[index].is_ascii_digit() { index += 1; } } @@ -67,7 +67,7 @@ pub fn collect_number(buffer: &[u8]) -> (usize, usize) { if index < len && (buffer[index] == b'-' || buffer[index] == b'+') { index += 1 } - while index < len && (b'0'..=b'9').contains(&buffer[index]) { + while index < len && buffer[index].is_ascii_digit() { index += 1; } } diff --git a/src/common/io/src/lib.rs b/src/common/io/src/lib.rs index 6b2164bcdf304..3390542595e87 100644 --- a/src/common/io/src/lib.rs +++ b/src/common/io/src/lib.rs @@ -14,6 +14,7 @@ // https://github.com/rust-lang/rust-clippy/issues/8334 #![allow(clippy::ptr_arg)] +#![allow(clippy::uninlined_format_args)] #![feature(can_vector)] #![feature(read_buf)] #![feature(slice_internals)] diff --git a/src/common/io/tests/it/main.rs b/src/common/io/tests/it/main.rs index 5200a91262b10..183695209c13f 100644 --- a/src/common/io/tests/it/main.rs +++ b/src/common/io/tests/it/main.rs @@ -12,6 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] mod binary_read; mod binary_write; diff --git a/src/common/jsonb/src/lib.rs b/src/common/jsonb/src/lib.rs index 890a341064006..eb2c1fbc5723a 100644 --- a/src/common/jsonb/src/lib.rs +++ b/src/common/jsonb/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod constants; mod de; mod error; diff --git a/src/common/metrics/src/lib.rs b/src/common/metrics/src/lib.rs index a199445bf2475..9748cab52707b 100644 --- a/src/common/metrics/src/lib.rs +++ b/src/common/metrics/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod counter; mod dump; mod recorder; diff --git a/src/common/storage/src/lib.rs b/src/common/storage/src/lib.rs index 596c082a805c6..a1a427535c519 100644 --- a/src/common/storage/src/lib.rs +++ b/src/common/storage/src/lib.rs @@ -28,6 +28,7 @@ //! - Table snapshots, segments cache must be stored accessed via cache operator. //! - Intermediate data generated by query could be stored by temporary operator. +#![allow(clippy::uninlined_format_args)] #![feature(no_sanitize)] #![feature(io_error_other)] diff --git a/src/common/tracing/src/lib.rs b/src/common/tracing/src/lib.rs index 40ab39deec2fa..775322156bb4e 100644 --- a/src/common/tracing/src/lib.rs +++ b/src/common/tracing/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] #[macro_use] diff --git a/src/meta/api/src/lib.rs b/src/meta/api/src/lib.rs index 0bdae21b50903..edbd83871868e 100644 --- a/src/meta/api/src/lib.rs +++ b/src/meta/api/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] extern crate common_meta_types; diff --git a/src/meta/app/src/lib.rs b/src/meta/app/src/lib.rs index 79f942e7dc44f..153c056196ebc 100644 --- a/src/meta/app/src/lib.rs +++ b/src/meta/app/src/lib.rs @@ -18,6 +18,7 @@ //! Types in this crate will not be used directly by databend-meta. //! But instead, they are used by the caller of meta-client, e.g, databend-query. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] pub mod schema; diff --git a/src/meta/client/src/lib.rs b/src/meta/client/src/lib.rs index e10648010b34a..1f5946cbec2a0 100644 --- a/src/meta/client/src/lib.rs +++ b/src/meta/client/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod grpc_action; mod grpc_client; mod kv_api_impl; diff --git a/src/meta/client/tests/it/main.rs b/src/meta/client/tests/it/main.rs index b2aeabf44c74f..99c16a43eec6b 100644 --- a/src/meta/client/tests/it/main.rs +++ b/src/meta/client/tests/it/main.rs @@ -11,6 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod grpc_client; mod grpc_server; diff --git a/src/meta/embedded/src/lib.rs b/src/meta/embedded/src/lib.rs index a6324eca758a5..760fae8fc7ebf 100644 --- a/src/meta/embedded/src/lib.rs +++ b/src/meta/embedded/src/lib.rs @@ -19,6 +19,8 @@ //! `MetaEmbedded` behave exactly the same as a metasrv without distributed logs(raft), since it is driven by //! a embedded raft `StateMachine`. +#![allow(clippy::uninlined_format_args)] + mod kv_api_impl; mod meta_embedded; diff --git a/src/meta/proto-conv/src/lib.rs b/src/meta/proto-conv/src/lib.rs index 30b66cbe53d40..78ca0e9ace639 100644 --- a/src/meta/proto-conv/src/lib.rs +++ b/src/meta/proto-conv/src/lib.rs @@ -14,6 +14,7 @@ // For use of const fn: `Option::::unwrap` at compile time. #![feature(const_option)] +#![allow(clippy::uninlined_format_args)] //! Provides conversion from and to protobuf defined meta data, which is used for transport. //! diff --git a/src/meta/proto-conv/tests/it/main.rs b/src/meta/proto-conv/tests/it/main.rs index b3a3054f91761..a1b6d99ad191b 100644 --- a/src/meta/proto-conv/tests/it/main.rs +++ b/src/meta/proto-conv/tests/it/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + #[macro_use] pub(crate) mod common; mod datatype; diff --git a/src/meta/protos/build.rs b/src/meta/protos/build.rs index a279e6130318a..5fdb6dfbbb55a 100644 --- a/src/meta/protos/build.rs +++ b/src/meta/protos/build.rs @@ -14,6 +14,8 @@ // // https://github.com/rust-lang/rustfmt/blob/e1ab878ccb24cda1b9e1c48865b375230385fede/build.rs +#![allow(clippy::uninlined_format_args)] + use std::env; use std::fs; use std::io::Error; diff --git a/src/meta/raft-store/src/lib.rs b/src/meta/raft-store/src/lib.rs index b270b5634f757..12301f35f1e49 100644 --- a/src/meta/raft-store/src/lib.rs +++ b/src/meta/raft-store/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod config; pub mod key_spaces; pub mod log; diff --git a/src/meta/raft-store/tests/it/main.rs b/src/meta/raft-store/tests/it/main.rs index 7ca71010732a2..de0888ea0b61c 100644 --- a/src/meta/raft-store/tests/it/main.rs +++ b/src/meta/raft-store/tests/it/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod log; #[macro_use] mod testing; diff --git a/src/meta/service/src/lib.rs b/src/meta/service/src/lib.rs index 53e37f6489333..7d302e61fbb19 100644 --- a/src/meta/service/src/lib.rs +++ b/src/meta/service/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod api; pub mod configs; pub mod export; diff --git a/src/meta/service/tests/it/main.rs b/src/meta/service/tests/it/main.rs index b2d8c1a1df456..b62d23c3f9c17 100644 --- a/src/meta/service/tests/it/main.rs +++ b/src/meta/service/tests/it/main.rs @@ -15,6 +15,7 @@ // Because the compiler complains about recursion limit for a trait requirement check... // error[[E0275](https://doc.rust-lang.org/error-index.html#E0275)]: overflow evaluating the requirement `(...)` // When compiling `impl KVApiBuilder for Builder`. +#![allow(clippy::uninlined_format_args)] #![recursion_limit = "1024"] #![feature(extend_one)] mod api; diff --git a/src/meta/sled-store/src/lib.rs b/src/meta/sled-store/src/lib.rs index ada5152315b1b..96435671f6aad 100644 --- a/src/meta/sled-store/src/lib.rs +++ b/src/meta/sled-store/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + //! sled_store implement a key-value like store backed by sled::Tree. //! //! It is used by raft for log and state machine storage. diff --git a/src/meta/sled-store/tests/it/main.rs b/src/meta/sled-store/tests/it/main.rs index f7850c483a1e1..010ca7fe19d9b 100644 --- a/src/meta/sled-store/tests/it/main.rs +++ b/src/meta/sled-store/tests/it/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod sled_tree; mod sled_txn_tree; mod testing; diff --git a/src/meta/types/src/lib.rs b/src/meta/types/src/lib.rs index 500111a90ad7d..d75de889f5529 100644 --- a/src/meta/types/src/lib.rs +++ b/src/meta/types/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(provide_any)] //! This crate defines data types used in meta data storage service. diff --git a/src/query/ast/src/lib.rs b/src/query/ast/src/lib.rs index bd56258c1e984..0d6962f7b8e32 100644 --- a/src/query/ast/src/lib.rs +++ b/src/query/ast/src/lib.rs @@ -14,6 +14,8 @@ // TODO(xuanwo): Add crate level documents here. +#![allow(clippy::uninlined_format_args)] + mod error; pub use error::Backtrace; diff --git a/src/query/ast/src/visitors/walk_mut.rs b/src/query/ast/src/visitors/walk_mut.rs index a6ffa5f9faaeb..9678b8e3958b1 100644 --- a/src/query/ast/src/visitors/walk_mut.rs +++ b/src/query/ast/src/visitors/walk_mut.rs @@ -15,7 +15,7 @@ use super::visitor_mut::VisitorMut; use crate::ast::*; -pub fn walk_expr_mut<'a, V: VisitorMut>(visitor: &mut V, expr: &mut Expr<'a>) { +pub fn walk_expr_mut(visitor: &mut V, expr: &mut Expr) { match expr { Expr::ColumnRef { span, @@ -134,11 +134,11 @@ pub fn walk_expr_mut<'a, V: VisitorMut>(visitor: &mut V, expr: &mut Expr<'a>) { } } -pub fn walk_identifier_mut<'a, V: VisitorMut>(visitor: &mut V, ident: &mut Identifier<'a>) { +pub fn walk_identifier_mut(visitor: &mut V, ident: &mut Identifier) { visitor.visit_identifier(ident); } -pub fn walk_query_mut<'a, V: VisitorMut>(visitor: &mut V, query: &mut Query<'a>) { +pub fn walk_query_mut(visitor: &mut V, query: &mut Query) { let Query { with, body, @@ -163,7 +163,7 @@ pub fn walk_query_mut<'a, V: VisitorMut>(visitor: &mut V, query: &mut Query<'a>) } } -pub fn walk_set_expr_mut<'a, V: VisitorMut>(visitor: &mut V, set_expr: &mut SetExpr<'a>) { +pub fn walk_set_expr_mut(visitor: &mut V, set_expr: &mut SetExpr) { match set_expr { SetExpr::Select(select) => { visitor.visit_select_stmt(select); @@ -177,7 +177,7 @@ pub fn walk_set_expr_mut<'a, V: VisitorMut>(visitor: &mut V, set_expr: &mut SetE } } -pub fn walk_select_target_mut<'a, V: VisitorMut>(visitor: &mut V, target: &mut SelectTarget<'a>) { +pub fn walk_select_target_mut(visitor: &mut V, target: &mut SelectTarget) { match target { SelectTarget::AliasedExpr { expr, alias } => { visitor.visit_expr(expr); @@ -206,10 +206,7 @@ pub fn walk_select_target_mut<'a, V: VisitorMut>(visitor: &mut V, target: &mut S } } -pub fn walk_table_reference_mut<'a, V: VisitorMut>( - visitor: &mut V, - table_ref: &mut TableReference<'a>, -) { +pub fn walk_table_reference_mut(visitor: &mut V, table_ref: &mut TableReference) { match table_ref { TableReference::Table { catalog, @@ -266,20 +263,14 @@ pub fn walk_table_reference_mut<'a, V: VisitorMut>( } } -pub fn walk_time_travel_point_mut<'a, V: VisitorMut>( - visitor: &mut V, - time: &mut TimeTravelPoint<'a>, -) { +pub fn walk_time_travel_point_mut(visitor: &mut V, time: &mut TimeTravelPoint) { match time { TimeTravelPoint::Snapshot(_) => {} TimeTravelPoint::Timestamp(expr) => visitor.visit_expr(expr), } } -pub fn walk_join_condition_mut<'a, V: VisitorMut>( - visitor: &mut V, - join_cond: &mut JoinCondition<'a>, -) { +pub fn walk_join_condition_mut(visitor: &mut V, join_cond: &mut JoinCondition) { match join_cond { JoinCondition::On(expr) => visitor.visit_expr(expr), JoinCondition::Using(using) => { @@ -292,14 +283,14 @@ pub fn walk_join_condition_mut<'a, V: VisitorMut>( } } -pub fn walk_cte_mut<'a, V: VisitorMut>(visitor: &mut V, cte: &mut CTE<'a>) { +pub fn walk_cte_mut(visitor: &mut V, cte: &mut CTE) { let CTE { alias, query, .. } = cte; visitor.visit_identifier(&mut alias.name); visitor.visit_query(query); } -pub fn walk_statement_mut<'a, V: VisitorMut>(visitor: &mut V, statement: &mut Statement<'a>) { +pub fn walk_statement_mut(visitor: &mut V, statement: &mut Statement) { match statement { Statement::Explain { kind, query } => visitor.visit_explain(kind, &mut *query), Statement::Query(query) => visitor.visit_query(&mut *query), diff --git a/src/query/ast/tests/it/main.rs b/src/query/ast/tests/it/main.rs index 0ef19d33c510b..39c8d8764d4c8 100644 --- a/src/query/ast/tests/it/main.rs +++ b/src/query/ast/tests/it/main.rs @@ -12,5 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod parser; mod token; diff --git a/src/query/catalog/src/lib.rs b/src/query/catalog/src/lib.rs index cfa663580503e..363010757581b 100644 --- a/src/query/catalog/src/lib.rs +++ b/src/query/catalog/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod catalog; pub mod catalog_kind; pub mod cluster_info; diff --git a/src/query/catalog/tests/it/main.rs b/src/query/catalog/tests/it/main.rs index a7e91d53548a0..69fb1412a6e9a 100644 --- a/src/query/catalog/tests/it/main.rs +++ b/src/query/catalog/tests/it/main.rs @@ -12,4 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod partitions; diff --git a/src/query/config/src/lib.rs b/src/query/config/src/lib.rs index 2a517be19fc94..167acbce60be0 100644 --- a/src/query/config/src/lib.rs +++ b/src/query/config/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(no_sanitize)] /// Config mods provide config support. diff --git a/src/query/datavalues/src/lib.rs b/src/query/datavalues/src/lib.rs index 0fc9cd1579ec9..2d1e001dac1c3 100644 --- a/src/query/datavalues/src/lib.rs +++ b/src/query/datavalues/src/lib.rs @@ -15,6 +15,7 @@ //! *Credits to the work of https://github.com/pola-rs/polars, which served as //! insipration for the crate* +#![allow(clippy::uninlined_format_args)] #![feature(trusted_len)] #![feature(cursor_remaining)] diff --git a/src/query/expression/src/lib.rs b/src/query/expression/src/lib.rs index ca02e05a2a3d5..ce91613787ce8 100755 --- a/src/query/expression/src/lib.rs +++ b/src/query/expression/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(fmt_internals)] #![feature(const_try)] #![feature(iterator_try_reduce)] diff --git a/src/query/expression/tests/it/main.rs b/src/query/expression/tests/it/main.rs index 25c99faa30f45..ef3bb922f4802 100644 --- a/src/query/expression/tests/it/main.rs +++ b/src/query/expression/tests/it/main.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(box_patterns)] #![feature(try_blocks)] diff --git a/src/query/formats/src/lib.rs b/src/query/formats/src/lib.rs index bcd7435a63fdd..edf33ec30c475 100644 --- a/src/query/formats/src/lib.rs +++ b/src/query/formats/src/lib.rs @@ -12,6 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(box_patterns)] mod clickhouse; diff --git a/src/query/functions/src/lib.rs b/src/query/functions/src/lib.rs index 40de8ab87e3a0..1e37f10967894 100644 --- a/src/query/functions/src/lib.rs +++ b/src/query/functions/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(core_intrinsics)] #![feature(box_patterns)] #![feature(type_ascription)] diff --git a/src/query/functions/tests/it/main.rs b/src/query/functions/tests/it/main.rs index 0b5029148ca0d..4b3f7d128f029 100644 --- a/src/query/functions/tests/it/main.rs +++ b/src/query/functions/tests/it/main.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(try_blocks)] #![feature(trait_alias)] diff --git a/src/query/management/src/lib.rs b/src/query/management/src/lib.rs index 45cecdb302d94..0ac9041733e4f 100644 --- a/src/query/management/src/lib.rs +++ b/src/query/management/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod cluster; mod quota; mod role; diff --git a/src/query/management/tests/it/main.rs b/src/query/management/tests/it/main.rs index 32544f805b8c8..50bef4be9db68 100644 --- a/src/query/management/tests/it/main.rs +++ b/src/query/management/tests/it/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod cluster; mod setting; mod stage; diff --git a/src/query/pipeline/sources/src/lib.rs b/src/query/pipeline/sources/src/lib.rs index d5d0986f4b682..1daf7f0caf7bf 100644 --- a/src/query/pipeline/sources/src/lib.rs +++ b/src/query/pipeline/sources/src/lib.rs @@ -13,6 +13,7 @@ // limitations under the License. #![feature(type_alias_impl_trait)] +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] pub mod processors; diff --git a/src/query/service/src/lib.rs b/src/query/service/src/lib.rs index 19da8d193a9a6..83157595fd47e 100644 --- a/src/query/service/src/lib.rs +++ b/src/query/service/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(hash_raw_entry)] #![feature(core_intrinsics)] #![feature(arbitrary_self_types)] diff --git a/src/query/service/src/servers/mysql/writers/query_result_writer.rs b/src/query/service/src/servers/mysql/writers/query_result_writer.rs index 6ff2b460756b2..79fbd8a9bf674 100644 --- a/src/query/service/src/servers/mysql/writers/query_result_writer.rs +++ b/src/query/service/src/servers/mysql/writers/query_result_writer.rs @@ -67,8 +67,8 @@ pub struct DFQueryResultWriter<'a, W: AsyncWrite + Send + Unpin> { inner: Option>, } -fn write_field<'a, W: AsyncWrite + Unpin>( - row_writer: &mut RowWriter<'a, W>, +fn write_field( + row_writer: &mut RowWriter, column: &ExprColumn, encoder: &FieldEncoderValues, buf: &mut Vec, diff --git a/src/query/service/tests/it/main.rs b/src/query/service/tests/it/main.rs index 528874ca334e5..db655147e4e27 100644 --- a/src/query/service/tests/it/main.rs +++ b/src/query/service/tests/it/main.rs @@ -11,6 +11,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + +#![allow(clippy::uninlined_format_args)] #![feature(thread_local)] mod api; diff --git a/src/query/service/tests/it/storages/fuse/operations/optimize.rs b/src/query/service/tests/it/storages/fuse/operations/optimize.rs index 4031813570be3..710fc41f764b1 100644 --- a/src/query/service/tests/it/storages/fuse/operations/optimize.rs +++ b/src/query/service/tests/it/storages/fuse/operations/optimize.rs @@ -81,7 +81,7 @@ async fn test_fuse_table_optimize() -> Result<()> { assert_eq!(parts.len(), n); // do compact - let query = format!("optimize table {}.{} compact", db_name, tbl_name); + let query = format!("optimize table {db_name}.{tbl_name} compact"); let mut planner = Planner::new(ctx.clone()); let (plan, _, _) = planner.plan_sql(&query).await?; @@ -95,7 +95,7 @@ async fn test_fuse_table_optimize() -> Result<()> { // only arrange one worker for the `ReadDataSourcePlan`. ctx.get_settings().set_max_threads(1)?; let data_stream = interpreter.execute(ctx.clone()).await?; - let _ = data_stream.try_collect::>(); + let _ = data_stream.try_collect::>().await; // verify compaction let table = fixture.latest_default_table().await?; diff --git a/src/query/settings/src/lib.rs b/src/query/settings/src/lib.rs index 4534d77d77a2a..f1bf5d7871d57 100644 --- a/src/query/settings/src/lib.rs +++ b/src/query/settings/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] use std::collections::BTreeMap; diff --git a/src/query/sharing-endpoint/src/lib.rs b/src/query/sharing-endpoint/src/lib.rs index 4831c98d70006..3cab3b4e8d803 100644 --- a/src/query/sharing-endpoint/src/lib.rs +++ b/src/query/sharing-endpoint/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub mod accessor; pub mod configs; pub mod handlers; diff --git a/src/query/sharing/src/lib.rs b/src/query/sharing/src/lib.rs index 7170beb741149..2992d2996e227 100644 --- a/src/query/sharing/src/lib.rs +++ b/src/query/sharing/src/lib.rs @@ -14,6 +14,8 @@ //! Sharing crate is used to provide Databend Cloud's sharing support. +#![allow(clippy::uninlined_format_args)] + mod layer; pub use layer::create_share_table_operator; diff --git a/src/query/sql/src/lib.rs b/src/query/sql/src/lib.rs index 54fc3b97bae4c..ea81d9e816cf1 100644 --- a/src/query/sql/src/lib.rs +++ b/src/query/sql/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(box_patterns)] pub mod evaluator; diff --git a/src/query/sql/src/planner/plans/copy_v2.rs b/src/query/sql/src/planner/plans/copy_v2.rs index 3ba7059c50363..7a09d08e1d26b 100644 --- a/src/query/sql/src/planner/plans/copy_v2.rs +++ b/src/query/sql/src/planner/plans/copy_v2.rs @@ -44,8 +44,7 @@ impl FromStr for ValidationMode { match rows { Ok(v) => Ok(ValidationMode::ReturnNRows(v)), Err(_) => Err(format!( - "Unknown validation mode:{:?}, must one of {{ RETURN__ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS}}", - v + "Unknown validation mode:{v:?}, must one of {{ RETURN__ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS}}" )), } } @@ -86,10 +85,10 @@ impl Debug for CopyPlanV2 { force, .. } => { - write!(f, "Copy into {:}.{:}", database_name, table_name)?; - write!(f, ", validation_mode: {:?}", validation_mode)?; - write!(f, ", from: {:?}", from)?; - write!(f, " force: {}", force)?; + write!(f, "Copy into {database_name:}.{table_name:}")?; + write!(f, ", validation_mode: {validation_mode:?}")?; + write!(f, ", from: {from:?}")?; + write!(f, " force: {force}")?; } CopyPlanV2::IntoStage { stage, @@ -97,9 +96,9 @@ impl Debug for CopyPlanV2 { validation_mode, .. } => { - write!(f, "Copy into {:?}", stage)?; - write!(f, ", path: {:?}", path)?; - write!(f, ", validation_mode: {:?}", validation_mode)?; + write!(f, "Copy into {stage:?}")?; + write!(f, ", path: {path:?}")?; + write!(f, ", validation_mode: {validation_mode:?}")?; } } Ok(()) diff --git a/src/query/sql/src/planner/plans/dummy_table_scan.rs b/src/query/sql/src/planner/plans/dummy_table_scan.rs index 7fc24d5f1c44a..b96aff3d31766 100644 --- a/src/query/sql/src/planner/plans/dummy_table_scan.rs +++ b/src/query/sql/src/planner/plans/dummy_table_scan.rs @@ -37,9 +37,9 @@ impl Operator for DummyTableScan { super::RelOp::DummyTableScan } - fn derive_relational_prop<'a>( + fn derive_relational_prop( &self, - _rel_expr: &crate::optimizer::RelExpr<'a>, + _rel_expr: &crate::optimizer::RelExpr, ) -> Result { Ok(RelationalProperty { output_columns: ColumnSet::new(), @@ -54,19 +54,19 @@ impl Operator for DummyTableScan { }) } - fn derive_physical_prop<'a>( + fn derive_physical_prop( &self, - _rel_expr: &crate::optimizer::RelExpr<'a>, + _rel_expr: &crate::optimizer::RelExpr, ) -> Result { Ok(PhysicalProperty { distribution: crate::optimizer::Distribution::Serial, }) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &crate::optimizer::RelExpr<'a>, + _rel_expr: &crate::optimizer::RelExpr, _child_index: usize, required: &crate::optimizer::RequiredProperty, ) -> Result { diff --git a/src/query/sql/src/planner/plans/eval_scalar.rs b/src/query/sql/src/planner/plans/eval_scalar.rs index 6c26ed2655b03..719661a9733cd 100644 --- a/src/query/sql/src/planner/plans/eval_scalar.rs +++ b/src/query/sql/src/planner/plans/eval_scalar.rs @@ -57,21 +57,21 @@ impl Operator for EvalScalar { RelOp::EvalScalar } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { rel_expr.derive_physical_prop_child(0) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { Ok(required.clone()) } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { let input_prop = rel_expr.derive_relational_prop_child(0)?; // Derive output columns diff --git a/src/query/sql/src/planner/plans/exchange.rs b/src/query/sql/src/planner/plans/exchange.rs index 377f2807fff10..49f546c7ab7a1 100644 --- a/src/query/sql/src/planner/plans/exchange.rs +++ b/src/query/sql/src/planner/plans/exchange.rs @@ -43,7 +43,7 @@ impl Operator for Exchange { rel_expr.derive_relational_prop_child(0) } - fn derive_physical_prop<'a>(&self, _rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, _rel_expr: &RelExpr) -> Result { Ok(PhysicalProperty { distribution: match self { Exchange::Random => Distribution::Random, @@ -54,10 +54,10 @@ impl Operator for Exchange { }) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { diff --git a/src/query/sql/src/planner/plans/filter.rs b/src/query/sql/src/planner/plans/filter.rs index deb039538f076..5e0c4c0d8edc1 100644 --- a/src/query/sql/src/planner/plans/filter.rs +++ b/src/query/sql/src/planner/plans/filter.rs @@ -52,21 +52,21 @@ impl Operator for Filter { RelOp::Filter } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { rel_expr.derive_physical_prop_child(0) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { Ok(required.clone()) } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { let input_prop = rel_expr.derive_relational_prop_child(0)?; let output_columns = input_prop.output_columns; diff --git a/src/query/sql/src/planner/plans/join.rs b/src/query/sql/src/planner/plans/join.rs index 8518cbb059ef2..b1a9147eec780 100644 --- a/src/query/sql/src/planner/plans/join.rs +++ b/src/query/sql/src/planner/plans/join.rs @@ -167,7 +167,7 @@ impl Operator for Join { RelOp::Join } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { let left_prop = rel_expr.derive_relational_prop_child(0)?; let right_prop = rel_expr.derive_relational_prop_child(1)?; @@ -234,7 +234,7 @@ impl Operator for Join { }) } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { let probe_prop = rel_expr.derive_physical_prop_child(0)?; let build_prop = rel_expr.derive_physical_prop_child(1)?; @@ -251,10 +251,10 @@ impl Operator for Join { } } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, ctx: Arc, - rel_expr: &RelExpr<'a>, + rel_expr: &RelExpr, child_index: usize, required: &RequiredProperty, ) -> Result { diff --git a/src/query/sql/src/planner/plans/limit.rs b/src/query/sql/src/planner/plans/limit.rs index 135680c05f805..3d09d0fdac707 100644 --- a/src/query/sql/src/planner/plans/limit.rs +++ b/src/query/sql/src/planner/plans/limit.rs @@ -37,14 +37,14 @@ impl Operator for Limit { RelOp::Limit } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { rel_expr.derive_physical_prop_child(0) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { @@ -53,7 +53,7 @@ impl Operator for Limit { Ok(required) } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { let input_prop = rel_expr.derive_relational_prop_child(0)?; Ok(RelationalProperty { diff --git a/src/query/sql/src/planner/plans/scalar.rs b/src/query/sql/src/planner/plans/scalar.rs index c0c55e0d56a30..b4501745c1a01 100644 --- a/src/query/sql/src/planner/plans/scalar.rs +++ b/src/query/sql/src/planner/plans/scalar.rs @@ -379,8 +379,7 @@ impl ComparisonOp { BinaryOperator::Eq => Ok(Self::Equal), BinaryOperator::NotEq => Ok(Self::NotEqual), _ => Err(ErrorCode::SemanticError(format!( - "Unsupported comparison operator {}", - op + "Unsupported comparison operator {op}" ))), } } diff --git a/src/query/sql/src/planner/plans/scan.rs b/src/query/sql/src/planner/plans/scan.rs index 0c6f5b986f6ba..f67219a0e6a2e 100644 --- a/src/query/sql/src/planner/plans/scan.rs +++ b/src/query/sql/src/planner/plans/scan.rs @@ -96,7 +96,7 @@ impl Operator for Scan { RelOp::Scan } - fn derive_relational_prop<'a>(&self, _rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, _rel_expr: &RelExpr) -> Result { let mut used_columns = ColumnSet::new(); if let Some(preds) = &self.push_down_predicates { for pred in preds.iter() { @@ -160,17 +160,17 @@ impl Operator for Scan { }) } - fn derive_physical_prop<'a>(&self, _rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, _rel_expr: &RelExpr) -> Result { Ok(PhysicalProperty { distribution: Distribution::Random, }) } // Won't be invoked at all, since `PhysicalScan` is leaf node - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, _required: &RequiredProperty, ) -> Result { diff --git a/src/query/sql/src/planner/plans/sort.rs b/src/query/sql/src/planner/plans/sort.rs index 422ceca8a7428..82873ecc89b48 100644 --- a/src/query/sql/src/planner/plans/sort.rs +++ b/src/query/sql/src/planner/plans/sort.rs @@ -44,14 +44,14 @@ impl Operator for Sort { RelOp::Sort } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { rel_expr.derive_physical_prop_child(0) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - _rel_expr: &RelExpr<'a>, + _rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { @@ -60,7 +60,7 @@ impl Operator for Sort { Ok(required) } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { rel_expr.derive_relational_prop_child(0) } } diff --git a/src/query/sql/src/planner/plans/union_all.rs b/src/query/sql/src/planner/plans/union_all.rs index e0df96d13306a..1736bf9163080 100644 --- a/src/query/sql/src/planner/plans/union_all.rs +++ b/src/query/sql/src/planner/plans/union_all.rs @@ -50,7 +50,7 @@ impl Operator for UnionAll { RelOp::UnionAll } - fn derive_relational_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_relational_prop(&self, rel_expr: &RelExpr) -> Result { let left_prop = rel_expr.derive_relational_prop_child(0)?; let right_prop = rel_expr.derive_relational_prop_child(1)?; @@ -99,17 +99,17 @@ impl Operator for UnionAll { }) } - fn derive_physical_prop<'a>(&self, rel_expr: &RelExpr<'a>) -> Result { + fn derive_physical_prop(&self, rel_expr: &RelExpr) -> Result { let left_child = rel_expr.derive_physical_prop_child(0)?; Ok(PhysicalProperty { distribution: left_child.distribution, }) } - fn compute_required_prop_child<'a>( + fn compute_required_prop_child( &self, _ctx: Arc, - rel_expr: &RelExpr<'a>, + rel_expr: &RelExpr, _child_index: usize, required: &RequiredProperty, ) -> Result { diff --git a/src/query/sql/tests/location.rs b/src/query/sql/tests/location.rs index 2fc4db8c215c6..a4b30e4daeaad 100644 --- a/src/query/sql/tests/location.rs +++ b/src/query/sql/tests/location.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod optimizer; use std::collections::BTreeMap; diff --git a/src/query/storages/common/blocks/src/lib.rs b/src/query/storages/common/blocks/src/lib.rs index 72fd409e48855..29c4293402ed9 100644 --- a/src/query/storages/common/blocks/src/lib.rs +++ b/src/query/storages/common/blocks/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod block; pub use block::blocks_to_parquet; diff --git a/src/query/storages/common/index/Cargo.toml b/src/query/storages/common/index/Cargo.toml index f2945f7c0d0e1..fda9759127775 100644 --- a/src/query/storages/common/index/Cargo.toml +++ b/src/query/storages/common/index/Cargo.toml @@ -12,7 +12,7 @@ doctest = false test = false [package.metadata.cargo-machete] -ignored = ["xorfilter-rs"] +ignored = ["xorfilter-rs", "match-template"] [dependencies] common-catalog = { path = "../../../catalog" } diff --git a/src/query/storages/common/index/benches/build_from_block.rs b/src/query/storages/common/index/benches/build_from_block.rs index ec2834da88d9e..149fc8eae542b 100644 --- a/src/query/storages/common/index/benches/build_from_block.rs +++ b/src/query/storages/common/index/benches/build_from_block.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + #[macro_use] extern crate criterion; diff --git a/src/query/storages/common/index/src/lib.rs b/src/query/storages/common/index/src/lib.rs index c46209234a2c0..1a732825e0da3 100644 --- a/src/query/storages/common/index/src/lib.rs +++ b/src/query/storages/common/index/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod bloom; pub mod filters; pub mod index_min_max; diff --git a/src/query/storages/common/index/tests/it/main.rs b/src/query/storages/common/index/tests/it/main.rs index 13948d2113955..22e76e2291d1b 100644 --- a/src/query/storages/common/index/tests/it/main.rs +++ b/src/query/storages/common/index/tests/it/main.rs @@ -12,4 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod filters; diff --git a/src/query/storages/common/pruner/src/lib.rs b/src/query/storages/common/pruner/src/lib.rs index 58014b2dcece7..6c2b5f23ef675 100644 --- a/src/query/storages/common/pruner/src/lib.rs +++ b/src/query/storages/common/pruner/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] mod limiter_pruner; diff --git a/src/query/storages/common/table-meta/src/lib.rs b/src/query/storages/common/table-meta/src/lib.rs index a8b559a419e82..f60c9b94862a2 100644 --- a/src/query/storages/common/table-meta/src/lib.rs +++ b/src/query/storages/common/table-meta/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] pub mod caches; diff --git a/src/query/storages/factory/src/lib.rs b/src/query/storages/factory/src/lib.rs index 3be30d1b28eeb..5bb108c9329b1 100644 --- a/src/query/storages/factory/src/lib.rs +++ b/src/query/storages/factory/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + pub use common_storages_fuse as fuse; pub use storages_common_index as index; mod storage_factory; diff --git a/src/query/storages/fuse/src/io/mod.rs b/src/query/storages/fuse/src/io/mod.rs index 6ccddcbf472d6..39391b68ac3f6 100644 --- a/src/query/storages/fuse/src/io/mod.rs +++ b/src/query/storages/fuse/src/io/mod.rs @@ -32,6 +32,7 @@ pub use read::SnapshotHistoryReader; pub use read::TableSnapshotReader; pub use read::UncompressedBuffer; pub use segments::try_join_futures; +pub use segments::try_join_futures_with_vec; pub use segments::SegmentsIO; pub use snapshots::ListSnapshotLiteOption; pub use snapshots::SnapshotLiteListExtended; diff --git a/src/query/storages/fuse/src/io/segments.rs b/src/query/storages/fuse/src/io/segments.rs index 93a63d515af29..20c1183bac3ed 100644 --- a/src/query/storages/fuse/src/io/segments.rs +++ b/src/query/storages/fuse/src/io/segments.rs @@ -131,3 +131,18 @@ where Ok(joint) } + +/// This is a workaround to address `higher-ranked lifetime error` from rustc +/// +/// TODO: remove me after rustc works with try_join_futures directly. +pub async fn try_join_futures_with_vec( + ctx: Arc, + futures: Vec, + thread_name: String, +) -> Result> +where + Fut: Future + Send + 'static, + Fut::Output: Send + 'static, +{ + try_join_futures(ctx, futures, thread_name).await +} diff --git a/src/query/storages/fuse/src/lib.rs b/src/query/storages/fuse/src/lib.rs index 8682b189877cb..0ab2cd4685c07 100644 --- a/src/query/storages/fuse/src/lib.rs +++ b/src/query/storages/fuse/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(type_alias_impl_trait)] #![feature(io_error_other)] #![feature(once_cell)] diff --git a/src/query/storages/fuse/src/operations/mutation/deletion/deletion_transform.rs b/src/query/storages/fuse/src/operations/mutation/deletion/deletion_transform.rs index 7e23580cee796..3ceaf7a53fc34 100644 --- a/src/query/storages/fuse/src/operations/mutation/deletion/deletion_transform.rs +++ b/src/query/storages/fuse/src/operations/mutation/deletion/deletion_transform.rs @@ -31,7 +31,7 @@ use storages_common_table_meta::meta::Location; use storages_common_table_meta::meta::SegmentInfo; use storages_common_table_meta::meta::Statistics; -use crate::io::try_join_futures; +use crate::io::try_join_futures_with_vec; use crate::io::SegmentsIO; use crate::io::TableMetaLocationGenerator; use crate::operations::mutation::deletion::deletion_meta::DeletionSourceMeta; @@ -162,7 +162,7 @@ impl DeletionTransform { }); } - try_join_futures( + try_join_futures_with_vec( self.ctx.clone(), handles, "deletion-write-segments-worker".to_owned(), @@ -328,7 +328,7 @@ impl Processor for DeletionTransform { // Read all segments information in parallel. let segments_io = SegmentsIO::create(self.ctx.clone(), self.dal.clone(), self.schema.clone()); - let segment_locations = &self.base_segments; + let segment_locations = self.base_segments.as_slice(); let segments = segments_io .read_segments(segment_locations) .await? diff --git a/src/query/storages/hive/hive-meta-store/build.rs b/src/query/storages/hive/hive-meta-store/build.rs index e1a97db085ca3..02eda6546e8ee 100644 --- a/src/query/storages/hive/hive-meta-store/build.rs +++ b/src/query/storages/hive/hive-meta-store/build.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + use std::env; use std::fs::File; use std::io::BufRead; diff --git a/src/query/storages/hive/hive-meta-store/src/lib.rs b/src/query/storages/hive/hive-meta-store/src/lib.rs index b1292b98b0758..41ff75aee0748 100644 --- a/src/query/storages/hive/hive-meta-store/src/lib.rs +++ b/src/query/storages/hive/hive-meta-store/src/lib.rs @@ -12,14 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![allow(clippy::all)] +// added for nightly-2022-12-15 +#![allow(clippy::uninlined_format_args)] +#![allow(clippy::derivable_impls)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::unused_unit)] +#![allow(clippy::redundant_field_names)] + + +#![allow(clippy::too_many_arguments, clippy::type_complexity, clippy::vec_box)] #![allow(dead_code)] #![allow(unreachable_patterns)] #![allow(unused_imports)] #![allow(unused_variables)] #![allow(unused_extern_crates)] #![allow(deprecated)] -#![allow(clippy::too_many_arguments, clippy::type_complexity, clippy::vec_box)] #![cfg_attr(rustfmt, rustfmt_skip)] mod hive_meta_store; diff --git a/src/query/storages/hive/hive/src/lib.rs b/src/query/storages/hive/hive/src/lib.rs index 201e48fba6bf9..87f34e43ecb7b 100644 --- a/src/query/storages/hive/hive/src/lib.rs +++ b/src/query/storages/hive/hive/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] mod converters; diff --git a/src/query/storages/memory/src/lib.rs b/src/query/storages/memory/src/lib.rs index d993ea2f35f5b..2fa3b85fa8864 100644 --- a/src/query/storages/memory/src/lib.rs +++ b/src/query/storages/memory/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod memory_part; mod memory_table; mod memory_table_stream; diff --git a/src/query/storages/parquet/src/lib.rs b/src/query/storages/parquet/src/lib.rs index b8d985a48b3b9..3eeaae307f894 100644 --- a/src/query/storages/parquet/src/lib.rs +++ b/src/query/storages/parquet/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![deny(unused_crate_dependencies)] mod parquet_column; diff --git a/src/query/storages/share/src/lib.rs b/src/query/storages/share/src/lib.rs index 8d59710b4ffd4..745a767ecc018 100644 --- a/src/query/storages/share/src/lib.rs +++ b/src/query/storages/share/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod share; pub use share::save_share_spec; diff --git a/src/query/storages/stage/src/lib.rs b/src/query/storages/stage/src/lib.rs index f1d6adab96d08..51d0d3619e2c3 100644 --- a/src/query/storages/stage/src/lib.rs +++ b/src/query/storages/stage/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod file; mod stage_table; mod stage_table_sink; diff --git a/src/query/storages/system/build.rs b/src/query/storages/system/build.rs index 47059f3f03899..d6d979b09d804 100644 --- a/src/query/storages/system/build.rs +++ b/src/query/storages/system/build.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + fn main() { common_building::setup(); } diff --git a/src/query/storages/system/src/lib.rs b/src/query/storages/system/src/lib.rs index b1cece41c8e6c..352b9f3ecbb82 100644 --- a/src/query/storages/system/src/lib.rs +++ b/src/query/storages/system/src/lib.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] #![feature(type_alias_impl_trait)] mod catalogs_table; diff --git a/src/query/users/src/lib.rs b/src/query/users/src/lib.rs index 3d4c3e2320191..1d79550ae9825 100644 --- a/src/query/users/src/lib.rs +++ b/src/query/users/src/lib.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![allow(clippy::uninlined_format_args)] + mod jwt; mod role_mgr; mod user; diff --git a/tests/sqllogictests/src/client/clickhouse_client.rs b/tests/sqllogictests/src/client/clickhouse_client.rs index d426d89443bd6..cd213434aed22 100644 --- a/tests/sqllogictests/src/client/clickhouse_client.rs +++ b/tests/sqllogictests/src/client/clickhouse_client.rs @@ -46,7 +46,7 @@ impl ClickhouseHttpClient { pub async fn query(&mut self, sql: &str) -> Result { if self.debug { - println!("Running sql with clickhouse client: [{}]", sql); + println!("Running sql with clickhouse client: [{sql}]"); } // Client will save the following info: use database, settings (session level info) // Then send them to server, so even though the session changes, database and settings context is correct diff --git a/tests/sqllogictests/src/client/http_client.rs b/tests/sqllogictests/src/client/http_client.rs index 3801915c4142d..7abee01341cc8 100644 --- a/tests/sqllogictests/src/client/http_client.rs +++ b/tests/sqllogictests/src/client/http_client.rs @@ -58,7 +58,7 @@ impl HttpClient { pub async fn query(&mut self, sql: &str) -> Result { if self.debug { - println!("Running sql with http client: [{}]", sql); + println!("Running sql with http client: [{sql}]"); } let url = "http://127.0.0.1:8000/v1/query".to_string(); let mut response = self.response(sql, &url, true).await?; @@ -70,7 +70,7 @@ impl HttpClient { } if let Some(error) = response.error { - return Err(format!("http query error: {}", error).into()); + return Err(format!("http query error: {error}").into()); } let rows = response.data; diff --git a/tests/sqllogictests/src/client/mysql_client.rs b/tests/sqllogictests/src/client/mysql_client.rs index ad3ff45564295..aea7848bc5de3 100644 --- a/tests/sqllogictests/src/client/mysql_client.rs +++ b/tests/sqllogictests/src/client/mysql_client.rs @@ -37,7 +37,7 @@ impl MysqlClient { pub async fn query(&mut self, sql: &str) -> Result { if self.debug { - println!("Running sql with mysql client: [{}]", sql); + println!("Running sql with mysql client: [{sql}]"); } let rows: Vec = self.conn.query(sql).await?; let types = vec![ColumnType::Any; rows.len()]; diff --git a/tests/suites/0_stateless/10_drivers/10_0001_python_sqlalchemy_driver.py b/tests/suites/0_stateless/10_drivers/10_0001_python_sqlalchemy_driver.py index 19b6e4a013fd3..e18b6a681c5f9 100755 --- a/tests/suites/0_stateless/10_drivers/10_0001_python_sqlalchemy_driver.py +++ b/tests/suites/0_stateless/10_drivers/10_0001_python_sqlalchemy_driver.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import sqlalchemy +from sqlalchemy import text import os tcp_port = os.getenv("QUERY_MYSQL_HANDLER_PORT") @@ -9,16 +10,19 @@ else: port = tcp_port + uri = "mysql+pymysql://root:root@localhost:" + port + "/" -engine = sqlalchemy.create_engine(uri) -conn = engine.connect() -conn.execute("create database if not exists book_db") -conn.execute("use book_db") -conn.execute( - "create table if not exists books(title varchar(255), author varchar(255), date varchar(255))" -) -conn.execute("insert into books values('mybook', 'author', '2022')") -results = conn.execute("select * from books").fetchall() -for result in results: - print(result) -conn.execute("drop database book_db") +engine = sqlalchemy.create_engine(uri, future=True) +with engine.connect() as conn: + conn.execute(text("create database if not exists book_db")) + conn.execute(text("use book_db")) + conn.execute( + text( + "create table if not exists books(title varchar(255), author varchar(255), date varchar(255))" + ) + ) + conn.execute(text("insert into books values('mybook', 'author', '2022')")) + results = conn.execute(text("select * from books")).fetchall() + conn.execute(text("drop database book_db")) + for result in results: + print(result) diff --git a/tests/suites/1_stateful/02_query/02_0000_kill_query.py b/tests/suites/1_stateful/02_query/02_0000_kill_query.py index 1059d004a2554..6d08a1eac1d78 100755 --- a/tests/suites/1_stateful/02_query/02_0000_kill_query.py +++ b/tests/suites/1_stateful/02_query/02_0000_kill_query.py @@ -42,7 +42,7 @@ "SELECT * FROM system.processes WHERE extra_info LIKE '%SELECT max(number), sum(number) FROM numbers_mt(100000000000) GROUP BY number % 3, number % 4, number % 5 LIMIT 10%' AND extra_info NOT LIKE '%system.processes%';" ) res = mycursor.fetchone() - + ## TODO NEW EXPRESSION ## assert res is None client1.expect(prompt)