mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-19 16:16:45 +00:00
chore(rust): simplify boolean expressions for clippy 1.96
This commit is contained in:
@@ -1430,13 +1430,13 @@ pub async fn apply_sync_snapshot_with_selection(
|
||||
.and_then(serde_json::Value::as_str)
|
||||
== Some("none"))
|
||||
});
|
||||
!forbidden_rocketmq_auth
|
||||
&& !(matches!(
|
||||
secret.key.as_str(),
|
||||
"password" | NACOS_AUTH_PASSWORD_KEY | NACOS_RNACOS_CONSOLE_PASSWORD_KEY
|
||||
) && connections
|
||||
.iter()
|
||||
.any(|config| config.id == secret.connection_id && !config.save_password))
|
||||
let password_like_secret_unsaved = matches!(
|
||||
secret.key.as_str(),
|
||||
"password" | NACOS_AUTH_PASSWORD_KEY | NACOS_RNACOS_CONSOLE_PASSWORD_KEY
|
||||
) && connections
|
||||
.iter()
|
||||
.any(|config| config.id == secret.connection_id && !config.save_password);
|
||||
!(forbidden_rocketmq_auth || password_like_secret_unsaved)
|
||||
})
|
||||
.map(|secret| SyncImportSecret {
|
||||
connection_id: secret.connection_id.clone(),
|
||||
|
||||
@@ -131,7 +131,7 @@ fn validate_signature_info(info: &str) -> Result<(), &'static str> {
|
||||
value.replace("/* exists */", "exists").chars().filter(|c| !c.is_whitespace() && *c != '"').collect()
|
||||
};
|
||||
let mut designated = info.lines().filter_map(|line| line.strip_prefix("designated => "));
|
||||
if !designated.next().is_some_and(|value| normalize(value) == normalize(RELEASE_REQUIREMENT))
|
||||
if designated.next().is_none_or(|value| normalize(value) != normalize(RELEASE_REQUIREMENT))
|
||||
|| designated.next().is_some()
|
||||
{
|
||||
return Err("a stable Developer ID designated requirement is required");
|
||||
|
||||
@@ -367,11 +367,11 @@ fn hint_arguments(tokens: &[TokenWithSpan]) -> Option<Vec<usize>> {
|
||||
let name = name.value.to_uppercase();
|
||||
pos += 1;
|
||||
if matches!(name.as_str(), "ALL_ROWS" | "FIRST_ROWS" | "RULE")
|
||||
&& !tokens.get(pos).is_some_and(|t| t.token == Token::LParen)
|
||||
&& tokens.get(pos).is_none_or(|t| t.token != Token::LParen)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if !tokens.get(pos).is_some_and(|t| t.token == Token::LParen) {
|
||||
if tokens.get(pos).is_none_or(|t| t.token != Token::LParen) {
|
||||
return None;
|
||||
}
|
||||
pos += 1;
|
||||
@@ -382,7 +382,7 @@ fn hint_arguments(tokens: &[TokenWithSpan]) -> Option<Vec<usize>> {
|
||||
{
|
||||
pos += 1;
|
||||
}
|
||||
if pos == start || !tokens.get(pos).is_some_and(|t| t.token == Token::RParen) {
|
||||
if pos == start || tokens.get(pos).is_none_or(|t| t.token != Token::RParen) {
|
||||
return None;
|
||||
}
|
||||
match name.as_str() {
|
||||
|
||||
@@ -875,9 +875,9 @@ impl SqlStatementSplitter {
|
||||
}
|
||||
|
||||
match ch {
|
||||
'\'' if !self.in_double_quote
|
||||
&& !self.in_backtick
|
||||
&& !(self.single_quote_backslash_escapes() && has_odd_trailing_backslashes(&self.buffer)) =>
|
||||
'\'' if !(self.in_double_quote
|
||||
|| self.in_backtick
|
||||
|| self.single_quote_backslash_escapes() && has_odd_trailing_backslashes(&self.buffer)) =>
|
||||
{
|
||||
self.in_single_quote = !self.in_single_quote;
|
||||
self.single_quote_escape_string = self.in_single_quote
|
||||
@@ -886,9 +886,9 @@ impl SqlStatementSplitter {
|
||||
&& ends_with_escape_string_prefix(&self.buffer)));
|
||||
self.buffer.push(ch);
|
||||
}
|
||||
'"' if !self.in_single_quote
|
||||
&& !self.in_backtick
|
||||
&& !(self.options.profile.supports_backslash_escaped_quotes
|
||||
'"' if !(self.in_single_quote
|
||||
|| self.in_backtick
|
||||
|| self.options.profile.supports_backslash_escaped_quotes
|
||||
&& has_odd_trailing_backslashes(&self.buffer)) =>
|
||||
{
|
||||
self.in_double_quote = !self.in_double_quote;
|
||||
@@ -1541,9 +1541,9 @@ fn split_sql_statement_ranges_with_options(sql: &str, options: SqlParsingOptions
|
||||
};
|
||||
|
||||
match ch {
|
||||
'\'' if !in_double_quote
|
||||
&& !in_backtick
|
||||
&& !(single_quote_backslash_escapes && has_odd_trailing_backslashes(&sql[start..i])) =>
|
||||
'\'' if !(in_double_quote
|
||||
|| in_backtick
|
||||
|| single_quote_backslash_escapes && has_odd_trailing_backslashes(&sql[start..i])) =>
|
||||
{
|
||||
in_single_quote = !in_single_quote;
|
||||
single_quote_escape_string = in_single_quote
|
||||
@@ -1552,9 +1552,9 @@ fn split_sql_statement_ranges_with_options(sql: &str, options: SqlParsingOptions
|
||||
&& ends_with_escape_string_prefix(&sql[start..i])));
|
||||
i += ch.len_utf8();
|
||||
}
|
||||
'"' if !in_single_quote
|
||||
&& !in_backtick
|
||||
&& !(options.profile.supports_backslash_escaped_quotes
|
||||
'"' if !(in_single_quote
|
||||
|| in_backtick
|
||||
|| options.profile.supports_backslash_escaped_quotes
|
||||
&& has_odd_trailing_backslashes(&sql[start..i])) =>
|
||||
{
|
||||
in_double_quote = !in_double_quote;
|
||||
@@ -2627,9 +2627,9 @@ impl SqlScanner {
|
||||
self.profile.supports_backslash_escaped_quotes
|
||||
};
|
||||
match ch {
|
||||
'\'' if !self.in_double_quote
|
||||
&& !self.in_backtick
|
||||
&& !(single_quote_backslash_escapes && self.previous == Some('\\')) =>
|
||||
'\'' if !(self.in_double_quote
|
||||
|| self.in_backtick
|
||||
|| single_quote_backslash_escapes && self.previous == Some('\\')) =>
|
||||
{
|
||||
self.in_single_quote = !self.in_single_quote;
|
||||
self.single_quote_escape_string = self.in_single_quote
|
||||
@@ -2637,9 +2637,9 @@ impl SqlScanner {
|
||||
|| (self.profile.supports_postgres_escape_strings
|
||||
&& ends_with_escape_string_prefix(&sql[..idx])));
|
||||
}
|
||||
'"' if !self.in_single_quote
|
||||
&& !self.in_backtick
|
||||
&& !(self.profile.supports_backslash_escaped_quotes && self.previous == Some('\\')) =>
|
||||
'"' if !(self.in_single_quote
|
||||
|| self.in_backtick
|
||||
|| self.profile.supports_backslash_escaped_quotes && self.previous == Some('\\')) =>
|
||||
{
|
||||
self.in_double_quote = !self.in_double_quote;
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ fn validate_sort_columns(
|
||||
let version = super::create_dialect::parse_version(context.server_version.as_deref());
|
||||
let primary = context.model.as_deref() == Some("primary");
|
||||
if !matches!(context.model.as_deref(), Some("primary" | "duplicate" | "aggregate" | "unique"))
|
||||
|| !version.is_some_and(|version| version >= if primary { (3, 0, 0) } else { (3, 3, 0) })
|
||||
|| version.is_none_or(|version| version < if primary { (3, 0, 0) } else { (3, 3, 0) })
|
||||
{
|
||||
warnings.push("Changing StarRocks sort keys requires confirmed table metadata and version 3.0+ for PRIMARY or 3.3+ for other models.".into());
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ fn is_column_extra_empty(extra: &ColumnExtra) -> bool {
|
||||
!extra.auto_increment.unwrap_or(false)
|
||||
&& !extra.on_update_current_timestamp.unwrap_or(false)
|
||||
&& is_column_identity_empty(&extra.identity)
|
||||
&& !extra.generated.as_ref().is_some_and(|generated| !generated.expression.trim().is_empty())
|
||||
&& extra.generated.as_ref().is_none_or(|generated| generated.expression.trim().is_empty())
|
||||
&& !extra.manticore_indexed.unwrap_or(false)
|
||||
&& !extra.manticore_stored.unwrap_or(false)
|
||||
&& !extra.manticore_attribute.unwrap_or(false)
|
||||
|
||||
@@ -122,7 +122,7 @@ fn validate(key: &OracleForeignKeyDefinition, oracle: bool) -> Result<(), &'stat
|
||||
}
|
||||
if (!key.state.deferrable && key.state.initially_deferred)
|
||||
|| (key.state.validated && key.state.rely)
|
||||
|| (!oracle && (key.state.deferrable || key.state.initially_deferred))
|
||||
|| (key.state.deferrable && !oracle)
|
||||
{
|
||||
return Err("The foreign key state is invalid or unsupported by this engine.");
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ pub(super) fn build(
|
||||
if context.automatic_bucket_scaling {
|
||||
warnings.push("This StarRocks table uses automatic bucket scaling (bucket_size > 0); changing distribution or bucket count through ALTER is not supported. Create a new table to change distribution.".into());
|
||||
}
|
||||
if !version.is_some_and(|v| v >= (3, 2, 0)) {
|
||||
if version.is_none_or(|v| v < (3, 2, 0)) {
|
||||
warnings.push("Changing StarRocks distribution requires confirmed version 3.2 or newer.".into());
|
||||
}
|
||||
if !layout.partitions.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user