From 9aff35ab152a11ec7d42aa89114bf1776621d2ba Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 25 Aug 2022 11:15:02 +1000 Subject: [PATCH] use some compound assignments (#1732) --- test/Serilog.Tests/Debugging/SelfLogTests.cs | 4 ++-- test/TestDummies/DummyRollingFileAuditSink.cs | 2 +- test/TestDummies/DummyRollingFileSink.cs | 2 +- test/TestDummies/DummyWrappingSink.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Serilog.Tests/Debugging/SelfLogTests.cs b/test/Serilog.Tests/Debugging/SelfLogTests.cs index 5e58df4b3..772d121a6 100644 --- a/test/Serilog.Tests/Debugging/SelfLogTests.cs +++ b/test/Serilog.Tests/Debugging/SelfLogTests.cs @@ -18,7 +18,7 @@ public void MessagesAreWrittenWhenOutputIsSet() Messages = new(); SelfLog.Enable(m => { - Messages = Messages ?? new(); + Messages ??= new(); Messages.Add(m); }); @@ -39,7 +39,7 @@ public void WritingToUndeclaredSinkWritesToSelfLog() Messages = new(); SelfLog.Enable(m => { - Messages = Messages ?? new(); + Messages ??= new(); Messages.Add(m); }); diff --git a/test/TestDummies/DummyRollingFileAuditSink.cs b/test/TestDummies/DummyRollingFileAuditSink.cs index d363c0815..a696e0036 100644 --- a/test/TestDummies/DummyRollingFileAuditSink.cs +++ b/test/TestDummies/DummyRollingFileAuditSink.cs @@ -10,7 +10,7 @@ public class DummyRollingFileAuditSink : ILogEventSink [ThreadStatic] static List? _emitted; - public static List Emitted => _emitted ?? (_emitted = new()); + public static List Emitted => _emitted ??= new(); public void Emit(LogEvent logEvent) { diff --git a/test/TestDummies/DummyRollingFileSink.cs b/test/TestDummies/DummyRollingFileSink.cs index 9232e733e..baf07b6c3 100644 --- a/test/TestDummies/DummyRollingFileSink.cs +++ b/test/TestDummies/DummyRollingFileSink.cs @@ -10,7 +10,7 @@ public class DummyRollingFileSink : ILogEventSink [ThreadStatic] static List? _emitted; - public static List Emitted => _emitted ?? (_emitted = new()); + public static List Emitted => _emitted ??= new(); public void Emit(LogEvent logEvent) { diff --git a/test/TestDummies/DummyWrappingSink.cs b/test/TestDummies/DummyWrappingSink.cs index 6241450e9..2a573f447 100644 --- a/test/TestDummies/DummyWrappingSink.cs +++ b/test/TestDummies/DummyWrappingSink.cs @@ -10,7 +10,7 @@ public class DummyWrappingSink : ILogEventSink [ThreadStatic] static List? _emitted; - public static List Emitted => _emitted ?? (_emitted = new()); + public static List Emitted => _emitted ??= new(); readonly ILogEventSink _sink;