From 43aa7e7303d8e70816dc39a1cbc912661c870c6d Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 13 Jan 2025 11:18:26 -0300 Subject: [PATCH] refactor: use reverse! and uniq! to modify the array in place --- src/invidious/routes/api/v1/authenticated.cr | 2 +- src/invidious/yt_backend/youtube_api.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr index 738a43de..a57dc405 100644 --- a/src/invidious/routes/api/v1/authenticated.cr +++ b/src/invidious/routes/api/v1/authenticated.cr @@ -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) diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index 6c1c6584..eed2e1a8 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -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)