From 1b2edd43eb705db921cd52b612c992017048a2ba Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 11 Mar 2024 16:55:06 -0400 Subject: [PATCH] Make enums copy --- .../flake8_bandit/rules/hashlib_insecure_hash_functions.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/rules/hashlib_insecure_hash_functions.rs b/crates/ruff_linter/src/rules/flake8_bandit/rules/hashlib_insecure_hash_functions.rs index f28b0668c14a6..e19d6eb848db1 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/rules/hashlib_insecure_hash_functions.rs +++ b/crates/ruff_linter/src/rules/flake8_bandit/rules/hashlib_insecure_hash_functions.rs @@ -89,7 +89,7 @@ pub(crate) fn hashlib_insecure_hash_functions(checker: &mut Checker, call: &ast: { match weak_hash_call { WeakHashCall::Hashlib { call: hashlib_call } => { - detect_insecure_hashlib_calls(checker, call, &hashlib_call); + detect_insecure_hashlib_calls(checker, call, hashlib_call); } WeakHashCall::Crypt => detect_insecure_crypt_calls(checker, call), } @@ -99,7 +99,7 @@ pub(crate) fn hashlib_insecure_hash_functions(checker: &mut Checker, call: &ast: fn detect_insecure_hashlib_calls( checker: &mut Checker, call: &ast::ExprCall, - hashlib_call: &HashlibCall, + hashlib_call: HashlibCall, ) { if !is_used_for_security(&call.arguments) { return; @@ -181,12 +181,13 @@ fn is_used_for_security(arguments: &Arguments) -> bool { .map_or(true, |keyword| !is_const_false(&keyword.value)) } +#[derive(Debug, Copy, Clone)] enum WeakHashCall { Hashlib { call: HashlibCall }, Crypt, } -#[derive(Debug)] +#[derive(Debug, Copy, Clone)] enum HashlibCall { New, WeakHash(&'static str),