Skip to content

Commit a3f3ed6

Browse files
committed
chore: simplify method implementations using expression-bodied members
1 parent 2abf034 commit a3f3ed6

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

Yubico.YubiKey/src/Yubico/YubiKey/Otp/Operations/CalculateChallengeResponse.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ protected override void ExecuteOperation()
102102
kb.TouchEvent += OnTouch;
103103
}
104104

105-
void OnTouch(object sender, EventArgs e)
106-
{
107-
_ = Task.Run(_touchNotify);
108-
}
105+
void OnTouch(object sender, EventArgs e) => _ = Task.Run(_touchNotify);
109106

110107
try
111108
{

Yubico.YubiKey/src/Yubico/YubiKey/Otp/OtpSettings.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ public YubiKeyFlags YubiKeyFlags
122122
// We would never use this for performance sensitive code,
123123
// but if we're throwing this exception, that's not a concern
124124
// here.
125-
static int GetBitCount(Flag b)
126-
{
127-
return Convert.ToString((byte)b, 2).ToCharArray().Count(c => c == '1');
128-
}
125+
static int GetBitCount(Flag b) => Convert.ToString((byte)b, 2).ToCharArray().Count(c => c == '1');
129126
}
130127
}
131128

Yubico.YubiKey/src/Yubico/YubiKey/Scp/Commands/ScpResponse.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public void ThrowIfFailed(string? message = null, bool includeStatusWord = true)
4949
: message ?? StatusMessage);
5050
}
5151

52-
string AddStatusWord(string originalMessage)
53-
{
54-
return $"{originalMessage} (StatusWord: 0x{StatusWord:X2})";
55-
}
52+
string AddStatusWord(string originalMessage) => $"{originalMessage} (StatusWord: 0x{StatusWord:X2})";
5653
}
5754
}

0 commit comments

Comments
 (0)