mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 13:05:06 +00:00
Use matches!
for insecure hash rule (#5141)
This commit is contained in:
parent
13813dc1b1
commit
fab2a4adf7
2 changed files with 39 additions and 32 deletions
|
@ -634,6 +634,18 @@ pub const fn is_const_true(expr: &Expr) -> bool {
|
|||
)
|
||||
}
|
||||
|
||||
/// Return `true` if an [`Expr`] is `False`.
|
||||
pub const fn is_const_false(expr: &Expr) -> bool {
|
||||
matches!(
|
||||
expr,
|
||||
Expr::Constant(ast::ExprConstant {
|
||||
value: Constant::Bool(false),
|
||||
kind: None,
|
||||
..
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
/// Return `true` if a keyword argument is present with a non-`None` value.
|
||||
pub fn has_non_none_keyword(keywords: &[Keyword], keyword: &str) -> bool {
|
||||
find_keyword(keywords, keyword).map_or(false, |keyword| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue