Skip to content

Commit

Permalink
Remove cast and use UnreachableException
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Nov 16, 2023
1 parent 4a5b918 commit ed48fb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions SteamKit2/Tests/CallbackManagerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void action( CallbackForTest cb )
didCall = true;
}

using (mgr.Subscribe( ( Action<CallbackForTest> )action ))
using (mgr.Subscribe<CallbackForTest>( action ))
{
PostAndRunCallback(callback);
}
Expand All @@ -54,7 +54,7 @@ void action( CallbackMsg cb )
didCall = true;
}

using (mgr.Subscribe( ( Action<CallbackMsg> )action ))
using ( mgr.Subscribe<CallbackMsg>( action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -76,7 +76,7 @@ void action( CallbackForTest cb )
didCall = true;
}

using (mgr.Subscribe(JobID.Invalid, ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( JobID.Invalid, action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -98,7 +98,7 @@ void action( CallbackForTest cb )
didCall = true;
}

using (mgr.Subscribe( ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -118,7 +118,7 @@ void action( CallbackForTest cb )
didCall = true;
}

using (mgr.Subscribe(123, ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( 123, action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -140,7 +140,7 @@ void action( CallbackForTest cb )
didCall = true;
}

using (mgr.Subscribe(123456, ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( 123456, action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -159,7 +159,7 @@ void action( CallbackForTest cb )
callCount++;
}

using (mgr.Subscribe( ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( action ) )
{
PostAndRunCallback(callback);
}
Expand All @@ -180,7 +180,7 @@ void action( CallbackForTest cb )
numCallbacksRun++;
}

using (mgr.Subscribe( ( Action<CallbackForTest> )action ))
using ( mgr.Subscribe<CallbackForTest>( action ) )
{
for (var i = 0; i < 10; i++)
{
Expand Down
3 changes: 2 additions & 1 deletion SteamKit2/Tests/StreamHelpersFacts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Threading;
Expand Down Expand Up @@ -72,7 +73,7 @@ static IConvertible ReadValue(int threadNumber, Stream s)
4 => s.ReadUInt32(),
5 => s.ReadInt64(),
6 => s.ReadUInt64(),
_ => throw new Exception( "Unreachable" ),
_ => throw new UnreachableException(),
};
}
}
Expand Down

0 comments on commit ed48fb1

Please sign in to comment.