From 0fd7b59fb1dbd67260429e1d75789fca92ab8a6f Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 4 Feb 2024 09:40:05 -0500 Subject: [PATCH] Remove variable assignment just before returning it --- .../apache/commons/codec/digest/MurmurHash3.java | 13 ++++--------- .../org/apache/commons/codec/digest/UnixCrypt.java | 5 ++--- .../codec/language/MatchRatingApproachEncoder.java | 9 ++------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java index ff80c1f9ce..197c70537e 100644 --- a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java +++ b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java @@ -1069,9 +1069,7 @@ public static long hash64(final byte[] data, final int offset, final int length, // finalization hash ^= length; - hash = fmix64(hash); - - return hash; + return fmix64(hash); } /** @@ -1113,8 +1111,7 @@ public static long hash64(final int data) { hash ^= k1; // finalization hash ^= Integer.BYTES; - hash = fmix64(hash); - return hash; + return fmix64(hash); } /** @@ -1158,8 +1155,7 @@ public static long hash64(final long data) { hash = Long.rotateLeft(hash, R2) * M + N1; // finalization hash ^= Long.BYTES; - hash = fmix64(hash); - return hash; + return fmix64(hash); } /** @@ -1204,8 +1200,7 @@ public static long hash64(final short data) { // finalization hash ^= Short.BYTES; - hash = fmix64(hash); - return hash; + return fmix64(hash); } /** diff --git a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java b/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java index 18f812fe98..dc77091ad8 100644 --- a/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java +++ b/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java @@ -399,10 +399,9 @@ private static int fourBytesToInt(final byte[] b, int offset) { return value; } - private static int hPermOp(int a, final int n, final int m) { + private static int hPermOp(final int a, final int n, final int m) { final int t = (a << 16 - n ^ a) & m; - a = a ^ t ^ t >>> 16 - n; - return a; + return a ^ t ^ t >>> 16 - n; } private static void intToFourBytes(final int iValue, final byte[] b, int offset) { diff --git a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java index 203fc348d8..16400c17a6 100644 --- a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java +++ b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java @@ -84,9 +84,7 @@ String cleanName(final String name) { } upperName = removeAccents(upperName); - upperName = upperName.replaceAll("\\s+", EMPTY); - - return upperName; + return upperName.replaceAll("\\s+", EMPTY); } /** @@ -143,10 +141,7 @@ public final String encode(String name) { // 2. Remove second consonant from any double consonant name = removeDoubleConsonants(name); - // 3. Reduce codex to 6 letters by joining the first 3 and last 3 letters - name = getFirst3Last3(name); - - return name; + return getFirst3Last3(name); } /**