Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Jul 12, 2021
1 parent a417187 commit c33e55f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/DiffEngineTray.Tests/AsyncTimerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public async Task It_calls_error_callback()
{
var errorCallbackInvoked = new TaskCompletionSource<bool>();

AsyncTimer timer = new(
var timer = new AsyncTimer(
callback: (_, _) => throw new("Simulated!"),
interval: TimeSpan.Zero,
errorCallback: _ => { errorCallbackInvoked.SetResult(true); });
Expand All @@ -24,7 +24,7 @@ public async Task It_continues_to_run_after_an_error()

var fail = true;
var exceptionThrown = false;
AsyncTimer timer = new(
var timer = new AsyncTimer(
callback: (_, _) =>
{
if (fail)
Expand All @@ -48,7 +48,7 @@ public async Task Stop_cancels_token_while_waiting()
{
var waitCanceled = false;
var delayStarted = new TaskCompletionSource<bool>();
AsyncTimer timer = new(
var timer = new AsyncTimer(
callback: (_, _) => throw new("Simulated!"),
interval: TimeSpan.FromDays(7),
delayStrategy: async (delayTime, token) =>
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task Stop_cancels_token_while_in_callback()
var callbackCanceled = false;
var callbackStarted = new TaskCompletionSource<bool>();
var stopInitiated = new TaskCompletionSource<bool>();
AsyncTimer timer = new(
var timer = new AsyncTimer(
callback: async (_, token) =>
{
callbackStarted.SetResult(true);
Expand All @@ -100,7 +100,7 @@ public async Task Stop_waits_for_callback_to_complete()
{
var callbackCompleted = new TaskCompletionSource<bool>();
var callbackTaskStarted = new TaskCompletionSource<bool>();
AsyncTimer timer = new(
var timer = new AsyncTimer(
callback: (_, _) =>
{
callbackTaskStarted.SetResult(true);
Expand Down
4 changes: 2 additions & 2 deletions src/DiffEngineTray.Tests/OptionsFormTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public OptionsFormTests(ITestOutputHelper output) :
[Fact]
public async Task WithKeys()
{
using OptionsForm form = new(
using var form = new OptionsForm(
new()
{
AcceptAllHotKey = new()
Expand All @@ -51,7 +51,7 @@ public async Task WithKeys()
[Fact]
public async Task Default()
{
using OptionsForm form = new(
using var form = new OptionsForm(
new(),
_ => Task.FromResult<IReadOnlyList<string>>(new List<string>()));
await Verifier.Verify(form);
Expand Down
8 changes: 4 additions & 4 deletions src/DiffEngineTray/PiperClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static Task SendMoveAsync(

static string BuildMovePayload(string tempFile, string targetFile, string? exe, string? arguments, bool canKill, int? processId)
{
StringBuilder builder = new($@"{{
var builder = new StringBuilder($@"{{
""Type"":""Move"",
""Temp"":""{tempFile.JsonEscape()}"",
""Target"":""{targetFile.JsonEscape()}"",
Expand Down Expand Up @@ -126,7 +126,7 @@ static void InnerSend(string payload)
{
client.Connect(endpoint);
using var stream = client.GetStream();
using StreamWriter writer = new(stream);
using var writer = new StreamWriter(stream);
writer.Write(payload);
}
finally
Expand All @@ -144,10 +144,10 @@ static async Task InnerSendAsync(string payload)
await client.ConnectAsync(endpoint.Address, endpoint.Port);
#if NETCOREAPP || netstandard21
await using var stream = client.GetStream();
await using StreamWriter writer = new(stream);
await using var writer = new StreamWriter(stream);
#else
using var stream = client.GetStream();
using StreamWriter writer = new(stream);
using var writer = new StreamWriter(stream);
#endif
await writer.WriteAsync(payload);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DiffEngineTray/Settings/OptionsFormLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static class OptionsFormLauncher
public static async Task Launch(KeyRegister keyRegister, Tracker tracker)
{
var settings = await SettingsHelper.Read();
using OptionsForm form = new(settings, async newSettings => await Save(keyRegister, tracker, newSettings));
using var form = new OptionsForm(settings, async newSettings => await Save(keyRegister, tracker, newSettings));
form.ShowDialog();
}

Expand Down
2 changes: 1 addition & 1 deletion src/DiffEngineTray/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static void Run()
{
var psCommandBytes = Encoding.Unicode.GetBytes("dotnet tool update diffenginetray --global; diffenginetray");
var psCommandBase64 = Convert.ToBase64String(psCommandBytes);
ProcessStartInfo info = new(
var info = new ProcessStartInfo(
"powershell.exe",
$"-NoProfile -ExecutionPolicy unrestricted -EncodedCommand {psCommandBase64}")
{
Expand Down

0 comments on commit c33e55f

Please sign in to comment.