Fix Style/RedundantNilInControlExpression type of Ameba issues

This commit is contained in:
Sijawusz Pur Rahnama 2026-01-11 22:35:01 +01:00
parent d371829477
commit 3a68d5aeb2
5 changed files with 7 additions and 7 deletions

View File

@ -149,7 +149,7 @@ struct Video
def dash_manifest_url : String?
raw_dash_url = info.dig?("streamingData", "dashManifestUrl").try &.as_s
return nil if raw_dash_url.nil?
return if raw_dash_url.nil?
# Use manifest v5 parameter to reduce file size
# See https://github.com/iv-org/invidious/issues/4186

View File

@ -7,7 +7,7 @@ require "json"
# TODO: "compactRadioRenderer" (Mix) and
# TODO: Use a proper struct/class instead of a hacky JSON object
def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
return nil if !related["videoId"]?
return if !related["videoId"]?
# The compact renderer has video length in seconds, where the end
# screen rendered has a full text version ("42:40")
@ -57,7 +57,7 @@ def extract_video_info(video_id : String)
player_response = YoutubeAPI.player(video_id: video_id)
if player_response.nil?
return nil
return
end
playability_status = player_response.dig?("playabilityStatus", "status").try &.as_s
@ -147,7 +147,7 @@ def try_fetch_streaming_data(id : String, client_config : YoutubeAPI::ClientConf
elsif playability_status == "OK"
return response
else
return nil
return
end
end

View File

@ -17,7 +17,7 @@
# another nil will be returned.
def extract_text(item : JSON::Any?) : String?
if item.nil?
return nil
return
end
if text_container = item["simpleText"]?

View File

@ -46,7 +46,7 @@ module UrlSanitizer
when "results", "search"
return :search
else # hashtag, post, trending, brand URLs, etc..
return nil
return
end
end

View File

@ -463,7 +463,7 @@ module YoutubeAPI
if CONFIG.invidious_companion.present?
return _post_invidious_companion("/youtubei/v1/player", data)
else
return nil
return
end
end