diff --git a/lib/livebook/file_system/s3.ex b/lib/livebook/file_system/s3.ex index 5aaabfbdc..387b703cb 100644 --- a/lib/livebook/file_system/s3.ex +++ b/lib/livebook/file_system/s3.ex @@ -323,8 +323,7 @@ defimpl Livebook.FileSystem, for: Livebook.FileSystem.S3 do defp encode_key(key) do key |> String.split("/") - |> Enum.map(fn segment -> URI.encode(segment, &URI.char_unreserved?/1) end) - |> Enum.join("/") + |> Enum.map_join("/", fn segment -> URI.encode(segment, &URI.char_unreserved?/1) end) end defp request_response_to_error(error) diff --git a/lib/livebook/live_markdown/markdown_helpers.ex b/lib/livebook/live_markdown/markdown_helpers.ex index a4327be20..978505797 100644 --- a/lib/livebook/live_markdown/markdown_helpers.ex +++ b/lib/livebook/live_markdown/markdown_helpers.ex @@ -38,9 +38,7 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpers do def text_from_ast(ast) def text_from_ast(ast) when is_list(ast) do - ast - |> Enum.map(&text_from_ast/1) - |> Enum.join("") + Enum.map_join(ast, &text_from_ast/1) end def text_from_ast(ast) when is_binary(ast), do: ast diff --git a/lib/livebook/session.ex b/lib/livebook/session.ex index e1045cf20..22baff901 100644 --- a/lib/livebook/session.ex +++ b/lib/livebook/session.ex @@ -1073,17 +1073,17 @@ defmodule Livebook.Session do with {:ok, source_exists?} <- FileSystem.File.exists?(source) do if source_exists? do with {:ok, destination_exists?} <- FileSystem.File.exists?(images_dir) do - if not destination_exists? do - # If the directory doesn't exist, we can just change - # the directory name, which is more efficient if - # available in the given file system - FileSystem.File.rename(source, images_dir) - else + if destination_exists? do # If the directory exists, we use copy to place # the images there with :ok <- FileSystem.File.copy(source, images_dir) do FileSystem.File.remove(source) end + else + # If the directory doesn't exist, we can just change + # the directory name, which is more efficient if + # available in the given file system + FileSystem.File.rename(source, images_dir) end end else diff --git a/lib/livebook_web/helpers/ansi.ex b/lib/livebook_web/helpers/ansi.ex index 4da7fd1f2..de9a8b799 100644 --- a/lib/livebook_web/helpers/ansi.ex +++ b/lib/livebook_web/helpers/ansi.ex @@ -31,9 +31,7 @@ defmodule LivebookWeb.Helpers.ANSI do end defp modifiers_to_css(modifiers) do - modifiers - |> Enum.map(&modifier_to_css/1) - |> Enum.join() + Enum.map_join(modifiers, &modifier_to_css/1) end defp modifier_to_css({:font_weight, :bold}), do: "font-weight: 600;"