mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-18 03:36:18 +00:00
only apply the rule if non-trivial
This commit is contained in:
parent
89236a3b2d
commit
3a10f87471
2 changed files with 28 additions and 33 deletions
|
|
@ -332,11 +332,14 @@ impl GotoTarget<'_> {
|
|||
model: &SemanticModel<'db>,
|
||||
) -> Option<Vec<CallSignatureDetails<'db>>> {
|
||||
if let GotoTarget::Call { call, .. } = self {
|
||||
let signature_details = call_signature_details(model.db(), model, call);
|
||||
if signature_details.len() > 1 {
|
||||
let signature_details = call_signature_details_typed(model.db(), model, call);
|
||||
if !signature_details.is_empty() {
|
||||
return Some(signature_details);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -233,9 +233,10 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.hover(), @r"
|
||||
(a, b) -> Unknown
|
||||
---------------------------------------------
|
||||
|
||||
def my_func(
|
||||
a,
|
||||
b
|
||||
) -> Unknown
|
||||
---------------------------------------------
|
||||
This is such a great func!!
|
||||
|
||||
|
|
@ -245,10 +246,11 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
```python
|
||||
(a, b) -> Unknown
|
||||
def my_func(
|
||||
a,
|
||||
b
|
||||
) -> Unknown
|
||||
```
|
||||
---
|
||||
|
||||
---
|
||||
```text
|
||||
This is such a great func!!
|
||||
|
|
@ -493,18 +495,14 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.hover(), @r"
|
||||
(val) -> MyClass
|
||||
---------------------------------------------
|
||||
|
||||
<class 'MyClass'>
|
||||
---------------------------------------------
|
||||
initializes MyClass (perfectly)
|
||||
|
||||
---------------------------------------------
|
||||
```python
|
||||
(val) -> MyClass
|
||||
<class 'MyClass'>
|
||||
```
|
||||
---
|
||||
|
||||
---
|
||||
```text
|
||||
initializes MyClass (perfectly)
|
||||
|
|
@ -556,18 +554,14 @@ mod tests {
|
|||
.build();
|
||||
|
||||
assert_snapshot!(test.hover(), @r"
|
||||
(val) -> MyClass
|
||||
---------------------------------------------
|
||||
|
||||
<class 'MyClass'>
|
||||
---------------------------------------------
|
||||
initializes MyClass (perfectly)
|
||||
|
||||
---------------------------------------------
|
||||
```python
|
||||
(val) -> MyClass
|
||||
<class 'MyClass'>
|
||||
```
|
||||
---
|
||||
|
||||
---
|
||||
```text
|
||||
initializes MyClass (perfectly)
|
||||
|
|
@ -618,9 +612,7 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.hover(), @r"
|
||||
(val) -> MyClass
|
||||
---------------------------------------------
|
||||
|
||||
<class 'MyClass'>
|
||||
---------------------------------------------
|
||||
This is such a great class!!
|
||||
|
||||
|
|
@ -630,10 +622,8 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
```python
|
||||
(val) -> MyClass
|
||||
<class 'MyClass'>
|
||||
```
|
||||
---
|
||||
|
||||
---
|
||||
```text
|
||||
This is such a great class!!
|
||||
|
|
@ -690,9 +680,10 @@ mod tests {
|
|||
);
|
||||
|
||||
assert_snapshot!(test.hover(), @r"
|
||||
(a, b) -> Unknown
|
||||
---------------------------------------------
|
||||
|
||||
bound method MyClass.my_method(
|
||||
a,
|
||||
b
|
||||
) -> Unknown
|
||||
---------------------------------------------
|
||||
This is such a great func!!
|
||||
|
||||
|
|
@ -702,10 +693,11 @@ mod tests {
|
|||
|
||||
---------------------------------------------
|
||||
```python
|
||||
(a, b) -> Unknown
|
||||
bound method MyClass.my_method(
|
||||
a,
|
||||
b
|
||||
) -> Unknown
|
||||
```
|
||||
---
|
||||
|
||||
---
|
||||
```text
|
||||
This is such a great func!!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue