mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-19 20:24:27 +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>,
|
model: &SemanticModel<'db>,
|
||||||
) -> Option<Vec<CallSignatureDetails<'db>>> {
|
) -> Option<Vec<CallSignatureDetails<'db>>> {
|
||||||
if let GotoTarget::Call { call, .. } = self {
|
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);
|
let signature_details = call_signature_details_typed(model.db(), model, call);
|
||||||
if !signature_details.is_empty() {
|
if !signature_details.is_empty() {
|
||||||
return Some(signature_details);
|
return Some(signature_details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,9 +233,10 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_snapshot!(test.hover(), @r"
|
assert_snapshot!(test.hover(), @r"
|
||||||
(a, b) -> Unknown
|
def my_func(
|
||||||
---------------------------------------------
|
a,
|
||||||
|
b
|
||||||
|
) -> Unknown
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
This is such a great func!!
|
This is such a great func!!
|
||||||
|
|
||||||
|
|
@ -245,10 +246,11 @@ mod tests {
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
```python
|
```python
|
||||||
(a, b) -> Unknown
|
def my_func(
|
||||||
|
a,
|
||||||
|
b
|
||||||
|
) -> Unknown
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
---
|
---
|
||||||
```text
|
```text
|
||||||
This is such a great func!!
|
This is such a great func!!
|
||||||
|
|
@ -493,18 +495,14 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_snapshot!(test.hover(), @r"
|
assert_snapshot!(test.hover(), @r"
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
initializes MyClass (perfectly)
|
initializes MyClass (perfectly)
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
```python
|
```python
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
---
|
---
|
||||||
```text
|
```text
|
||||||
initializes MyClass (perfectly)
|
initializes MyClass (perfectly)
|
||||||
|
|
@ -556,18 +554,14 @@ mod tests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assert_snapshot!(test.hover(), @r"
|
assert_snapshot!(test.hover(), @r"
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
initializes MyClass (perfectly)
|
initializes MyClass (perfectly)
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
```python
|
```python
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
---
|
---
|
||||||
```text
|
```text
|
||||||
initializes MyClass (perfectly)
|
initializes MyClass (perfectly)
|
||||||
|
|
@ -618,9 +612,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_snapshot!(test.hover(), @r"
|
assert_snapshot!(test.hover(), @r"
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
---------------------------------------------
|
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
This is such a great class!!
|
This is such a great class!!
|
||||||
|
|
||||||
|
|
@ -630,10 +622,8 @@ mod tests {
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
```python
|
```python
|
||||||
(val) -> MyClass
|
<class 'MyClass'>
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
---
|
---
|
||||||
```text
|
```text
|
||||||
This is such a great class!!
|
This is such a great class!!
|
||||||
|
|
@ -690,9 +680,10 @@ mod tests {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_snapshot!(test.hover(), @r"
|
assert_snapshot!(test.hover(), @r"
|
||||||
(a, b) -> Unknown
|
bound method MyClass.my_method(
|
||||||
---------------------------------------------
|
a,
|
||||||
|
b
|
||||||
|
) -> Unknown
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
This is such a great func!!
|
This is such a great func!!
|
||||||
|
|
||||||
|
|
@ -702,10 +693,11 @@ mod tests {
|
||||||
|
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
```python
|
```python
|
||||||
(a, b) -> Unknown
|
bound method MyClass.my_method(
|
||||||
|
a,
|
||||||
|
b
|
||||||
|
) -> Unknown
|
||||||
```
|
```
|
||||||
---
|
|
||||||
|
|
||||||
---
|
---
|
||||||
```text
|
```text
|
||||||
This is such a great func!!
|
This is such a great func!!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue