diff --git a/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs b/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
index 9c9786e0a..bb884019b 100644
--- a/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
@@ -16,12 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
///
public IImageFormat DetectFormat(ReadOnlySpan header)
{
- if (this.IsSupportedFileFormat(header))
- {
- return ImageFormats.Bmp;
- }
-
- return null;
+ return this.IsSupportedFileFormat(header) ? ImageFormats.Bmp : null;
}
private bool IsSupportedFileFormat(ReadOnlySpan header)
diff --git a/src/ImageSharp/Formats/ImageFormatManager.cs b/src/ImageSharp/Formats/ImageFormatManager.cs
index 4e33a0445..63fd02d8d 100644
--- a/src/ImageSharp/Formats/ImageFormatManager.cs
+++ b/src/ImageSharp/Formats/ImageFormatManager.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
namespace SixLabors.ImageSharp.Formats
{
@@ -87,9 +86,9 @@ namespace SixLabors.ImageSharp.Formats
{
Guard.NotNullOrWhiteSpace(extension, nameof(extension));
- if (extension[0] == '.')
- {
- extension = extension.Substring(1);
+ if (extension[0] == '.')
+ {
+ extension = extension.Substring(1);
}
return this.imageFormats.FirstOrDefault(x => x.FileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase));
@@ -158,12 +157,10 @@ namespace SixLabors.ImageSharp.Formats
public IImageDecoder FindDecoder(IImageFormat format)
{
Guard.NotNull(format, nameof(format));
- if (this.mimeTypeDecoders.TryGetValue(format, out IImageDecoder decoder))
- {
- return decoder;
- }
- return null;
+ return this.mimeTypeDecoders.TryGetValue(format, out IImageDecoder decoder)
+ ? decoder
+ : null;
}
///
@@ -174,12 +171,10 @@ namespace SixLabors.ImageSharp.Formats
public IImageEncoder FindEncoder(IImageFormat format)
{
Guard.NotNull(format, nameof(format));
- if (this.mimeTypeEncoders.TryGetValue(format, out IImageEncoder encoder))
- {
- return encoder;
- }
- return null;
+ return this.mimeTypeEncoders.TryGetValue(format, out IImageEncoder encoder)
+ ? encoder
+ : null;
}
///
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
index 5105e57ab..2937b23a7 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
@@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
/// Returns the for the YCbCr colorspace that matches the current CPU architecture.
///
private static JpegColorConverter GetYCbCrConverter() =>
- JpegColorConverter.FromYCbCrSimdAvx2.IsAvailable ? (JpegColorConverter)new JpegColorConverter.FromYCbCrSimdAvx2() : new JpegColorConverter.FromYCbCrSimd();
+ FromYCbCrSimdAvx2.IsAvailable ? (JpegColorConverter)new FromYCbCrSimdAvx2() : new FromYCbCrSimd();
///
/// A stack-only struct to reference the input buffers using -s.
diff --git a/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs b/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
index 36b43a470..c1c039a1b 100644
--- a/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
+++ b/src/ImageSharp/Formats/Png/PngImageFormatDetector.cs
@@ -17,12 +17,7 @@ namespace SixLabors.ImageSharp.Formats.Png
///
public IImageFormat DetectFormat(ReadOnlySpan header)
{
- if (this.IsSupportedFileFormat(header))
- {
- return ImageFormats.Png;
- }
-
- return null;
+ return this.IsSupportedFileFormat(header) ? ImageFormats.Png : null;
}
private bool IsSupportedFileFormat(ReadOnlySpan header)
diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs
index 443ae6a37..9087db414 100644
--- a/src/ImageSharp/Image.Decode.cs
+++ b/src/ImageSharp/Image.Decode.cs
@@ -48,12 +48,10 @@ namespace SixLabors.ImageSharp
private static IImageDecoder DiscoverDecoder(Stream stream, Configuration config, out IImageFormat format)
{
format = InternalDetectFormat(stream, config);
- if (format != null)
- {
- return config.ImageFormatsManager.FindDecoder(format);
- }
- return null;
+ return format != null
+ ? config.ImageFormatsManager.FindDecoder(format)
+ : null;
}
#pragma warning disable SA1008 // Opening parenthesis must be spaced correctly