mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 07:34:06 -05:00
Use matches! for insecure hash rule (#5141)
This commit is contained in:
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user