refactor: use reverse! and uniq! to modify the array in place
All checks were successful
Invidious CI / build (push) Successful in 5m27s

This commit is contained in:
Fijxu 2025-01-13 11:18:26 -03:00
parent a08fafd852
commit 43aa7e7303
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
2 changed files with 2 additions and 2 deletions

View file

@ -482,7 +482,7 @@ module Invidious::Routes::API::V1::Authenticated
env.response.content_type = "text/event-stream"
raw_topics = env.params.body["topics"]? || env.params.query["topics"]?
topics = raw_topics.try &.split(",").uniq.first(1000)
topics = raw_topics.try &.split(",").uniq!.first(1000)
topics ||= [] of String
create_notification_stream(env, topics, CONNECTION_CHANNEL)

View file

@ -724,7 +724,7 @@ module YoutubeAPI
# Multiple encodings can be combined, and are listed in the order
# in which they were applied. E.g: "deflate, gzip" means that the
# content must be first "gunzipped", then "defated".
encodings.split(',').reverse.each do |enc|
encodings.split(',').reverse!.each do |enc|
case enc.strip(' ')
when "gzip"
body_io = Compress::Gzip::Reader.new(body_io, sync_close: true)