From dcde5038bead59a0019bdfebf02c4bb17734d743 Mon Sep 17 00:00:00 2001 From: InSyncWithFoo Date: Sat, 16 Nov 2024 01:46:41 +0000 Subject: [PATCH] `?` --- .../rules/ruff/rules/tuple_map_int_version_parsing.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/ruff_linter/src/rules/ruff/rules/tuple_map_int_version_parsing.rs b/crates/ruff_linter/src/rules/ruff/rules/tuple_map_int_version_parsing.rs index 329a7694ae158..849c7a4e4e140 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/tuple_map_int_version_parsing.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/tuple_map_int_version_parsing.rs @@ -1,5 +1,3 @@ -use std::ops::Deref; - use ruff_diagnostics::{Diagnostic, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_ast::{Expr, ExprAttribute, ExprCall, ExprName}; @@ -71,10 +69,7 @@ fn tuple_like_call_with_single_argument<'a>( semantic: &SemanticModel, call: &'a ExprCall, ) -> Option<&'a Expr> { - let Some((func, positionals)) = func_and_positionals(call) else { - return None; - }; - + let Some((func, positionals)) = func_and_positionals(call)?; let func_is = |symbol: &str| semantic.match_builtin_expr(func, symbol); if !func_is("tuple") && !func_is("list") || positionals.len() != 1 { @@ -88,9 +83,7 @@ fn map_call_with_two_arguments<'a>( semantic: &SemanticModel, call: &'a ExprCall, ) -> Option<(&'a Expr, &'a Expr)> { - let Some((func, positionals)) = func_and_positionals(call) else { - return None; - }; + let Some((func, positionals)) = func_and_positionals(call)?; if !semantic.match_builtin_expr(func, "map") || positionals.len() != 2 { return None;