Use matches! for insecure hash rule (#5141)

This commit is contained in:
Charlie Marsh 2023-06-16 00:18:32 -04:00 committed by GitHub
parent 13813dc1b1
commit fab2a4adf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 32 deletions

View file

@ -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| {