Fix warnings: Use expression body for lambda expressions
MODIFY
WalletWasabi.Backend/Startup.cs
WalletWasabi.Backend/Startup.cs
@@ -45,10 +45,7 @@ public class Startup
services.AddMvc()
.AddNewtonsoftJson();
- services.AddControllers().AddNewtonsoftJson(x =>
- {
- x.SerializerSettings.Converters = JsonSerializationOptions.Default.Settings.Converters;
- });
+ services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.Converters = JsonSerializationOptions.Default.Settings.Converters);
// Register the Swagger generator, defining one or more Swagger documents
services.AddSwaggerGen(c =>

MODIFY
WalletWasabi.Fluent.Generators/NavigationMetaDataGenerator.cs
WalletWasabi.Fluent.Generators/NavigationMetaDataGenerator.cs
@@ -89,10 +89,7 @@ namespace WalletWasabi.Fluent
public void Initialize(GeneratorInitializationContext context)
{
// System.Diagnostics.Debugger.Launch();
- context.RegisterForPostInitialization((i) =>
- {
- i.AddSource("NavigationMetaDataAttribute.cs", SourceText.From(AttributeText, Encoding.UTF8));
- });
+ context.RegisterForPostInitialization((i) => i.AddSource("NavigationMetaDataAttribute.cs", SourceText.From(AttributeText, Encoding.UTF8)));
context.RegisterForSyntaxNotifications(() => new SyntaxReceiver());
}

MODIFY
WalletWasabi.Fluent.Generators/StaticViewLocatorGenerator.cs
WalletWasabi.Fluent.Generators/StaticViewLocatorGenerator.cs
@@ -31,10 +31,7 @@ namespace WalletWasabi.Fluent
public void Initialize(GeneratorInitializationContext context)
{
// System.Diagnostics.Debugger.Launch();
- context.RegisterForPostInitialization((i) =>
- {
- i.AddSource("StaticViewLocatorAttribute.cs", SourceText.From(AttributeText, Encoding.UTF8));
- });
+ context.RegisterForPostInitialization((i) => i.AddSource("StaticViewLocatorAttribute.cs", SourceText.From(AttributeText, Encoding.UTF8)));
context.RegisterForSyntaxNotifications(() => new SyntaxReceiver());
}

MODIFY
WalletWasabi.Fluent/Behaviors/HistoryItemDetailsBehavior.cs
WalletWasabi.Fluent/Behaviors/HistoryItemDetailsBehavior.cs
@@ -19,10 +19,7 @@ public class HistoryItemDetailsBehavior : DisposingBehavior<DataBoxRow>
if (AssociatedObject is not null)
{
Observable.FromEventPattern(AssociatedObject, nameof(AssociatedObject.DetachedFromVisualTree))
- .Subscribe(x =>
- {
- Remove();
- })
+ .Subscribe(x => Remove())
.DisposeWith(disposables);
AssociatedObject

MODIFY
WalletWasabi.Fluent/Behaviors/RandomizedWorldPointsBehavior.cs
WalletWasabi.Fluent/Behaviors/RandomizedWorldPointsBehavior.cs
@@ -112,10 +112,7 @@ public class RandomizedWorldPointsBehavior : Behavior<Canvas>
return;
}
- await Dispatcher.UIThread.InvokeAsync(() =>
- {
- target.SetValue(Control.OpacityProperty, 0, BindingPriority.StyleTrigger);
- });
+ await Dispatcher.UIThread.InvokeAsync(() => target.SetValue(Control.OpacityProperty, 0, BindingPriority.StyleTrigger));
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
@@ -128,10 +125,7 @@ public class RandomizedWorldPointsBehavior : Behavior<Canvas>
await Task.Delay(TimeSpan.FromSeconds(2), cancellationToken);
- await Dispatcher.UIThread.InvokeAsync(() =>
- {
- target.SetValue(Control.OpacityProperty, 0, BindingPriority.StyleTrigger);
- });
+ await Dispatcher.UIThread.InvokeAsync(() => target.SetValue(Control.OpacityProperty, 0, BindingPriority.StyleTrigger));
}
protected override void OnDetaching()

MODIFY
WalletWasabi.Fluent/CrashReport/ViewModels/CrashReportWindowViewModel.cs
WalletWasabi.Fluent/CrashReport/ViewModels/CrashReportWindowViewModel.cs
@@ -17,10 +17,7 @@ public class CrashReportWindowViewModel : ViewModelBase
CancelCommand = ReactiveCommand.Create(AppLifetimeHelper.Restart);
NextCommand = ReactiveCommand.Create(AppLifetimeHelper.Shutdown);
- OpenGitHubRepoCommand = ReactiveCommand.CreateFromTask(async () =>
- {
- await IoHelpers.OpenBrowserAsync(AboutViewModel.UserSupportLink);
- });
+ OpenGitHubRepoCommand = ReactiveCommand.CreateFromTask(async () => await IoHelpers.OpenBrowserAsync(AboutViewModel.UserSupportLink));
CopyTraceCommand = ReactiveCommand.CreateFromTask(async () =>
{

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/ShowQrCameraDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/ShowQrCameraDialogViewModel.cs
@@ -66,10 +66,7 @@ public partial class ShowQrCameraDialogViewModel : DialogViewModelBase<string?>
})
.DisposeWith(disposables);
- disposables.Add(Disposable.Create(() =>
- {
- RxApp.MainThreadScheduler.Schedule(async () => await _qrReader.StopScanningAsync());
- }));
+ disposables.Add(Disposable.Create(() => RxApp.MainThreadScheduler.Schedule(async () => await _qrReader.StopScanningAsync())));
RxApp.MainThreadScheduler.Schedule(async () => await _qrReader.StartScanningAsync());
}

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -86,10 +86,7 @@ public partial class NavBarViewModel : ViewModelBase
UiServices.WalletManager.WhenAnyValue(x => x.SelectedWallet)
.WhereNotNull()
.OfType<NavBarItemViewModel>()
- .Subscribe(x =>
- {
- SelectedItem = x;
- });
+ .Subscribe(x => SelectedItem = x);
}
public ReadOnlyObservableCollection<NavBarItemViewModel> Items => UiServices.WalletManager.Items;

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/AddressViewModel.cs
@@ -36,10 +36,7 @@ public partial class AddressViewModel : ViewModelBase
EditLabelCommand =
ReactiveCommand.Create(() => parent.NavigateToAddressEdit(model, parent.Wallet.KeyManager));
- NavigateCommand = ReactiveCommand.Create(() =>
- {
- parent.Navigate().To(new ReceiveAddressViewModel(wallet, model));
- });
+ NavigateCommand = ReactiveCommand.Create(() => parent.Navigate().To(new ReceiveAddressViewModel(wallet, model)));
}
public ICommand CopyAddressCommand { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendFeeViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendFeeViewModel.cs
@@ -68,10 +68,7 @@ public partial class SendFeeViewModel : DialogViewModelBase<FeeRate>
.FromEventPattern(feeProvider, nameof(feeProvider.AllFeeEstimateChanged))
.Select(x => (x.EventArgs as AllFeeEstimate)!.Estimations)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(estimations =>
- {
- FeeChart.UpdateFeeEstimates(TransactionFeeHelper.GetFeeEstimates(_wallet), _transactionInfo.MaximumPossibleFeeRate);
- })
+ .Subscribe(estimations => FeeChart.UpdateFeeEstimates(TransactionFeeHelper.GetFeeEstimates(_wallet), _transactionInfo.MaximumPossibleFeeRate))
.DisposeWith(disposables);
RxApp.MainThreadScheduler.Schedule(async () =>

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionSummaryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionSummaryViewModel.cs
@@ -30,7 +30,7 @@ public partial class TransactionSummaryViewModel : ViewModelBase
IsPreview = isPreview;
this.WhenAnyValue(x => x.TransactionHasChange, x => x.TransactionHasPockets)
- .Subscribe(_ => { MaxPrivacy = !TransactionHasPockets && !TransactionHasChange; });
+ .Subscribe(_ => MaxPrivacy = !TransactionHasPockets && !TransactionHasChange);
AddressText = _address.ToString();
PayJoinUrl = info.PayJoinClient?.PaymentUrl.AbsoluteUri;

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -110,17 +110,11 @@ public partial class WalletViewModel : WalletViewModelBase
this.WhenAnyValue(x => x.HeightSource)
.Subscribe(x => LayoutSelector(_widthSource, x));
- SendCommand = ReactiveCommand.Create(() =>
- {
- Navigate(NavigationTarget.DialogScreen)
- .To(new SendViewModel(wallet));
- });
+ SendCommand = ReactiveCommand.Create(() => Navigate(NavigationTarget.DialogScreen)
+ .To(new SendViewModel(wallet)));
- ReceiveCommand = ReactiveCommand.Create(() =>
- {
- Navigate(NavigationTarget.DialogScreen)
- .To(new ReceiveViewModel(wallet));
- });
+ ReceiveCommand = ReactiveCommand.Create(() => Navigate(NavigationTarget.DialogScreen)
+ .To(new ReceiveViewModel(wallet)));
WalletInfoCommand = ReactiveCommand.CreateFromTask(async () =>
{

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Startup.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/Startup.cs
@@ -20,10 +20,7 @@ public class Startup
{
app.UseStaticFiles();
app.UseRouting();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
+ app.UseEndpoints(endpoints => endpoints.MapControllers());
}
public void ConfigureServices(IServiceCollection services)

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiApiApplicationFactory.cs
@@ -39,10 +39,7 @@ public class WabiSabiApiApplicationFactory<TStartup> : WebApplicationFactory<TSt
protected override IHostBuilder CreateHostBuilder()
{
- var builder = Host.CreateDefaultBuilder().ConfigureWebHostDefaults(x =>
- {
- x.UseStartup<TStartup>().UseTestServer();
- });
+ var builder = Host.CreateDefaultBuilder().ConfigureWebHostDefaults(x => x.UseStartup<TStartup>().UseTestServer());
return builder;
}
@@ -59,10 +56,7 @@ public class WabiSabiApiApplicationFactory<TStartup> : WebApplicationFactory<TSt
services.AddScoped<WabiSabiConfig>();
services.AddScoped(typeof(TimeSpan), _ => TimeSpan.FromSeconds(2));
});
- builder.ConfigureLogging(o =>
- {
- o.SetMinimumLevel(LogLevel.Warning);
- });
+ builder.ConfigureLogging(o => o.SetMinimumLevel(LogLevel.Warning));
}
public Task<ArenaClient> CreateArenaClientAsync(HttpClient httpClient) =>

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Integration/WabiSabiHttpApiIntegrationTests.cs
@@ -79,7 +79,6 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
.ToArray();
var httpClient = _apiApplicationFactory.WithWebHostBuilder(builder =>
- {
builder.ConfigureServices(services =>
{
var rpc = BitcoinFactory.GetMockMinimalRpc();
@@ -112,8 +111,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
MaxInputCountByRound = inputCount,
StandardInputRegistrationTimeout = TimeSpan.FromSeconds(10)
});
- });
- }).CreateClient();
+ })).CreateClient();
// Create the coinjoin client
using PersonCircuit personCircuit = new();
@@ -178,7 +176,6 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
.ToArray();
var httpClient = _apiApplicationFactory.WithWebHostBuilder(builder =>
- {
builder.ConfigureServices(services =>
{
var rpc = BitcoinFactory.GetMockMinimalRpc();
@@ -213,8 +210,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
BlameInputRegistrationTimeout = TimeSpan.FromSeconds(20),
TransactionSigningTimeout = TimeSpan.FromSeconds(5 * inputCount),
});
- });
- }).CreateClient();
+ })).CreateClient();
// Create the coinjoin client
using PersonCircuit personCircuit = new();
@@ -298,7 +294,6 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
var rpc = node.RpcClient;
var app = _apiApplicationFactory.WithWebHostBuilder(builder =>
- {
builder.ConfigureServices(services =>
{
// Instruct the coordinator DI container to use these two scoped
@@ -312,8 +307,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
ConnectionConfirmationTimeout = TimeSpan.FromSeconds(20 * ExpectedInputNumber),
OutputRegistrationTimeout = TimeSpan.FromSeconds(20 * ExpectedInputNumber),
});
- });
- });
+ }));
using PersonCircuit personCircuit = new();
IHttpClient httpClientWrapper = new HttpClientWrapper(app.CreateClient());
@@ -388,7 +382,6 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
new TxOut(Money.Coins(1), signingKey.PubKey.WitHash.ScriptPubKey));
var httpClient = _apiApplicationFactory.WithWebHostBuilder(builder =>
- {
builder.ConfigureServices(services =>
{
var rpc = BitcoinFactory.GetMockMinimalRpc();
@@ -400,8 +393,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
TxOut = coinToRegister.TxOut
};
services.AddScoped<IRPCClient>(s => rpc);
- });
- }).CreateClient();
+ })).CreateClient();
var apiClient = await _apiApplicationFactory.CreateArenaClientAsync(httpClient);
var rounds = await apiClient.GetStatusAsync(CancellationToken.None);
@@ -422,7 +414,6 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
fromTxOut: new TxOut(Money.Coins(1), signingKey.PubKey.WitHash.ScriptPubKey));
using HttpClient httpClient = _apiApplicationFactory.WithWebHostBuilder(builder =>
- {
builder.ConfigureServices(services =>
{
var rpc = BitcoinFactory.GetMockMinimalRpc();
@@ -434,8 +425,7 @@ public class WabiSabiHttpApiIntegrationTests : IClassFixture<WabiSabiApiApplicat
TxOut = coinToRegister.TxOut
};
services.AddScoped<IRPCClient>(s => rpc);
- });
- }).CreateClient();
+ })).CreateClient();
ArenaClient apiClient = await _apiApplicationFactory.CreateArenaClientAsync(new StuttererHttpClient(httpClient));
RoundState[] rounds = await apiClient.GetStatusAsync(CancellationToken.None);

Fix warnings: Use expression body for lambda expressions