From 6cc392a6753829565a0ba40a32b1825a6eaa7540 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Fri, 9 Jun 2023 19:27:32 +0530 Subject: [PATCH] Rename `Self` to concrete type in method As without editor support it might be hard to figure out what the concrete type is --- .../src/rules/ruff/rules/implicit_optional.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/ruff/src/rules/ruff/rules/implicit_optional.rs b/crates/ruff/src/rules/ruff/rules/implicit_optional.rs index 9f89d2eec1bb9..17f2c62622bed 100644 --- a/crates/ruff/src/rules/ruff/rules/implicit_optional.rs +++ b/crates/ruff/src/rules/ruff/rules/implicit_optional.rs @@ -183,34 +183,34 @@ impl<'a> TypingTarget<'a> { /// Check if the [`TypingTarget`] explicitly allows `None`. fn contains_none(&self, model: &SemanticModel) -> bool { match self { - Self::None | Self::Optional | Self::Any => true, - Self::Literal(elements) => elements.iter().any(|element| { - let Some(new_target) = Self::try_from_expr(model, element) else { + TypingTarget::None | TypingTarget::Optional | TypingTarget::Any => true, + TypingTarget::Literal(elements) => elements.iter().any(|element| { + let Some(new_target) = TypingTarget::try_from_expr(model, element) else { return false; }; // Literal can only contain `None`, a literal value, other `Literal` // or an enum value. match new_target { - Self::None => true, - Self::Literal(_) => new_target.contains_none(model), + TypingTarget::None => true, + TypingTarget::Literal(_) => new_target.contains_none(model), _ => false, } }), - Self::Union(elements) => elements.iter().any(|element| { - let Some(new_target) = Self::try_from_expr(model, element) else { + TypingTarget::Union(elements) => elements.iter().any(|element| { + let Some(new_target) = TypingTarget::try_from_expr(model, element) else { return false; }; match new_target { - Self::None => true, + TypingTarget::None => true, _ => new_target.contains_none(model), } }), - Self::Annotated(element) => { - let Some(new_target) = Self::try_from_expr(model, element) else { + TypingTarget::Annotated(element) => { + let Some(new_target) = TypingTarget::try_from_expr(model, element) else { return false; }; match new_target { - Self::None => true, + TypingTarget::None => true, _ => new_target.contains_none(model), } }