From 5077fbbdb470eea1a894ed660bfde0e2c3fd7159 Mon Sep 17 00:00:00 2001 From: "Teppei.F" <37261985+T3pp31@users.noreply.github.com> Date: Fri, 17 Apr 2026 20:55:46 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20decrypt=5Fsafe=E3=81=A7decrypt?= =?UTF-8?q?=E3=82=92=E5=86=85=E9=83=A8=E5=88=A9=E7=94=A8=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/caesar_cipher.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/caesar_cipher.rs b/src/caesar_cipher.rs index f5ada48..9a8d763 100644 --- a/src/caesar_cipher.rs +++ b/src/caesar_cipher.rs @@ -167,7 +167,8 @@ pub fn encrypt_safe(text: &str, shift: i16) -> Result { /// Decrypts text using Caesar cipher with error handling /// /// This function validates input values and returns an error for invalid inputs. -/// Validates shift range before negation to prevent integer overflow. +/// Internally uses `decrypt` after validation, so fixes in `decrypt` +/// are automatically reflected in this safe API. /// /// # Arguments /// @@ -203,7 +204,7 @@ pub fn decrypt_safe(text: &str, shift: i16) -> Result { ))); } - Ok(shift_text(text, -shift)) + Ok(decrypt(text, shift)) } /// Internal implementation: Performs text-level Caesar cipher transformation