Fix warning: Type cast is redundant (#2149)

This commit is contained in:
KonH 2021-10-03 11:05:18 +07:00
parent d45fcdd5af
commit 6cbfdea4c0
7 changed files with 8 additions and 8 deletions

View File

@ -137,7 +137,7 @@ namespace Jellyfin.Api.Controllers
} }
var existingDisplayPreferences = _displayPreferencesManager.GetDisplayPreferences(userId, itemId, client); var existingDisplayPreferences = _displayPreferencesManager.GetDisplayPreferences(userId, itemId, client);
existingDisplayPreferences.IndexBy = Enum.TryParse<IndexingKind>(displayPreferences.IndexBy, true, out var indexBy) ? indexBy : (IndexingKind?)null; existingDisplayPreferences.IndexBy = Enum.TryParse<IndexingKind>(displayPreferences.IndexBy, true, out var indexBy) ? indexBy : null;
existingDisplayPreferences.ShowBackdrop = displayPreferences.ShowBackdrop; existingDisplayPreferences.ShowBackdrop = displayPreferences.ShowBackdrop;
existingDisplayPreferences.ShowSidebar = displayPreferences.ShowSidebar; existingDisplayPreferences.ShowSidebar = displayPreferences.ShowSidebar;

View File

@ -263,8 +263,8 @@ namespace Jellyfin.Api.Controllers
item.DateCreated = NormalizeDateTime(request.DateCreated.Value); item.DateCreated = NormalizeDateTime(request.DateCreated.Value);
} }
item.EndDate = request.EndDate.HasValue ? NormalizeDateTime(request.EndDate.Value) : (DateTime?)null; item.EndDate = request.EndDate.HasValue ? NormalizeDateTime(request.EndDate.Value) : null;
item.PremiereDate = request.PremiereDate.HasValue ? NormalizeDateTime(request.PremiereDate.Value) : (DateTime?)null; item.PremiereDate = request.PremiereDate.HasValue ? NormalizeDateTime(request.PremiereDate.Value) : null;
item.ProductionYear = request.ProductionYear; item.ProductionYear = request.ProductionYear;
item.OfficialRating = string.IsNullOrWhiteSpace(request.OfficialRating) ? null : request.OfficialRating; item.OfficialRating = string.IsNullOrWhiteSpace(request.OfficialRating) ? null : request.OfficialRating;
item.CustomRating = request.CustomRating; item.CustomRating = request.CustomRating;

View File

@ -20,7 +20,7 @@ namespace Jellyfin.Api.Helpers
var value = GetClaimValue(user, InternalClaimTypes.UserId); var value = GetClaimValue(user, InternalClaimTypes.UserId);
return string.IsNullOrEmpty(value) return string.IsNullOrEmpty(value)
? null ? null
: (Guid?)Guid.Parse(value); : Guid.Parse(value);
} }
/// <summary> /// <summary>

View File

@ -120,7 +120,7 @@ namespace Jellyfin.Server.Migrations.Routines
var displayPreferences = new DisplayPreferences(dtoUserId, itemId, client) var displayPreferences = new DisplayPreferences(dtoUserId, itemId, client)
{ {
IndexBy = Enum.TryParse<IndexingKind>(dto.IndexBy, true, out var indexBy) ? indexBy : (IndexingKind?)null, IndexBy = Enum.TryParse<IndexingKind>(dto.IndexBy, true, out var indexBy) ? indexBy : null,
ShowBackdrop = dto.ShowBackdrop, ShowBackdrop = dto.ShowBackdrop,
ShowSidebar = dto.ShowSidebar, ShowSidebar = dto.ShowSidebar,
ScrollDirection = dto.ScrollDirection, ScrollDirection = dto.ScrollDirection,

View File

@ -1229,7 +1229,7 @@ namespace MediaBrowser.Model.Dlna
bool result = IsAudioEligibleForDirectPlay(item, maxBitrate, playMethod); bool result = IsAudioEligibleForDirectPlay(item, maxBitrate, playMethod);
return (result, result ? (TranscodeReason?)null : TranscodeReason.ContainerBitrateExceedsLimit); return (result, result ? null : TranscodeReason.ContainerBitrateExceedsLimit);
} }
public static SubtitleProfile GetSubtitleProfile( public static SubtitleProfile GetSubtitleProfile(

View File

@ -513,7 +513,7 @@ namespace Rssdp.Infrastructure
return TimeSpan.Zero; return TimeSpan.Zero;
} }
return (TimeSpan)(headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero); return headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero;
} }
private void RemoveExpiredDevicesFromCache() private void RemoveExpiredDevicesFromCache()

View File

@ -20,7 +20,7 @@ namespace Jellyfin.Networking.Tests
CallBase = true CallBase = true
}; };
configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf); configManager.Setup(x => x.GetConfiguration(It.IsAny<string>())).Returns(conf);
return (IConfigurationManager)configManager.Object; return configManager.Object;
} }
/// <summary> /// <summary>