mirror of https://github.com/astral-sh/ruff
Fix lack of `not` in `PLC1901` error message (#3497)
This commit is contained in:
parent
62ff3b62e3
commit
a82fe4a139
|
|
@ -34,8 +34,8 @@ impl TryFrom<&Cmpop> for EmptyStringCmpop {
|
||||||
impl EmptyStringCmpop {
|
impl EmptyStringCmpop {
|
||||||
pub fn into_unary(self) -> &'static str {
|
pub fn into_unary(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Is | Self::Eq => "",
|
Self::Is | Self::Eq => "not ",
|
||||||
Self::IsNot | Self::NotEq => "not ",
|
Self::IsNot | Self::NotEq => "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ expression: diagnostics
|
||||||
---
|
---
|
||||||
- kind:
|
- kind:
|
||||||
name: CompareToEmptyString
|
name: CompareToEmptyString
|
||||||
body: "`x is \"\"` can be simplified to `x` as an empty string is falsey"
|
body: "`x is \"\"` can be simplified to `not x` as an empty string is falsey"
|
||||||
suggestion: ~
|
suggestion: ~
|
||||||
fixable: false
|
fixable: false
|
||||||
location:
|
location:
|
||||||
|
|
@ -17,7 +17,7 @@ expression: diagnostics
|
||||||
parent: ~
|
parent: ~
|
||||||
- kind:
|
- kind:
|
||||||
name: CompareToEmptyString
|
name: CompareToEmptyString
|
||||||
body: "`x == \"\"` can be simplified to `x` as an empty string is falsey"
|
body: "`x == \"\"` can be simplified to `not x` as an empty string is falsey"
|
||||||
suggestion: ~
|
suggestion: ~
|
||||||
fixable: false
|
fixable: false
|
||||||
location:
|
location:
|
||||||
|
|
@ -30,7 +30,7 @@ expression: diagnostics
|
||||||
parent: ~
|
parent: ~
|
||||||
- kind:
|
- kind:
|
||||||
name: CompareToEmptyString
|
name: CompareToEmptyString
|
||||||
body: "`y is not \"\"` can be simplified to `not y` as an empty string is falsey"
|
body: "`y is not \"\"` can be simplified to `y` as an empty string is falsey"
|
||||||
suggestion: ~
|
suggestion: ~
|
||||||
fixable: false
|
fixable: false
|
||||||
location:
|
location:
|
||||||
|
|
@ -43,7 +43,7 @@ expression: diagnostics
|
||||||
parent: ~
|
parent: ~
|
||||||
- kind:
|
- kind:
|
||||||
name: CompareToEmptyString
|
name: CompareToEmptyString
|
||||||
body: "`y != \"\"` can be simplified to `not y` as an empty string is falsey"
|
body: "`y != \"\"` can be simplified to `y` as an empty string is falsey"
|
||||||
suggestion: ~
|
suggestion: ~
|
||||||
fixable: false
|
fixable: false
|
||||||
location:
|
location:
|
||||||
|
|
@ -56,7 +56,7 @@ expression: diagnostics
|
||||||
parent: ~
|
parent: ~
|
||||||
- kind:
|
- kind:
|
||||||
name: CompareToEmptyString
|
name: CompareToEmptyString
|
||||||
body: "`\"\" != z` can be simplified to `not z` as an empty string is falsey"
|
body: "`\"\" != z` can be simplified to `z` as an empty string is falsey"
|
||||||
suggestion: ~
|
suggestion: ~
|
||||||
fixable: false
|
fixable: false
|
||||||
location:
|
location:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue