Skip to content

Commit 4096ed3

Browse files
committed
fix some warnings by prefixing unused variable with _
1 parent 759b0f4 commit 4096ed3

1 file changed

Lines changed: 18 additions & 22 deletions

File tree

lib/mongo_ecto.ex

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ defmodule Mongo.Ecto do
476476
def dumpers(:binary, type), do: [type, &dump_binary(&1, :generic)]
477477
def dumpers(_base, type), do: [type]
478478

479-
defp dump_time({h, m, s, _} = time), do: Time.from_erl({h, m, s})
479+
defp dump_time({h, m, s, _}), do: Time.from_erl({h, m, s})
480480
defp dump_time(_), do: :error
481481

482482
defp dump_date({_, _, _} = date) do
@@ -512,10 +512,8 @@ defmodule Mongo.Ecto do
512512

513513
defp dump_naive_datetime(_), do: :error
514514

515-
@doc """
516-
Copy from the Elixir 1.4.5. TODO: Replace with native methods, when we stick on ~> 1.4.
517-
Source: https://github.com/elixir-lang/elixir/blob/v1.4/lib/elixir/lib/calendar.ex#L1477
518-
"""
515+
# Copy from the Elixir 1.4.5. TODO: Replace with native methods, when we stick on ~> 1.4.
516+
# Source: https://github.com/elixir-lang/elixir/blob/v1.4/lib/elixir/lib/calendar.ex#L1477
519517
defp datetime_from_naive(
520518
%NaiveDateTime{
521519
hour: hour,
@@ -544,10 +542,9 @@ defmodule Mongo.Ecto do
544542
}}
545543
end
546544

547-
@doc """
548-
Copy from the Elixir 1.4.5. TODO: Replace with native methods, when we stick on ~> 1.4.
549-
Source: https://github.com/elixir-lang/elixir/blob/v1.4/lib/elixir/lib/calendar.ex#L1477
550-
"""
545+
546+
# Copy from the Elixir 1.4.5. TODO: Replace with native methods, when we stick on ~> 1.4.
547+
# Source: https://github.com/elixir-lang/elixir/blob/v1.4/lib/elixir/lib/calendar.ex#L1477
551548
defp datetime_from_naive!(naive_datetime, time_zone) do
552549
case datetime_from_naive(naive_datetime, time_zone) do
553550
{:ok, datetime} ->
@@ -606,18 +603,17 @@ defmodule Mongo.Ecto do
606603
# This can be backed by a normal mongo stream, we just have to get it to play nicely with
607604
# ecto's batch/preload functionality ( hence the map(&{nil, [&1]}) )
608605
@doc false
609-
def stream(repo, meta, {:nocache, {function, query}}, params, process, opts) do
610-
stream_or_stub =
611-
case apply(NormalizedQuery, function, [query, params]) do
612-
%{__struct__: read} = query when read in @read_queries ->
613-
Connection.read(repo, query, opts)
614-
|> Stream.map(&process_document(&1, query, process))
606+
def stream(repo, _meta, {:nocache, {function, query}}, params, process, opts) do
607+
case apply(NormalizedQuery, function, [query, params]) do
608+
%{__struct__: read} = query when read in @read_queries ->
609+
Connection.read(repo, query, opts)
610+
|> Stream.map(&process_document(&1, query, process))
615611

616-
%WriteQuery{} = write ->
617-
apply(Connection, function, [repo, write, opts])
618-
[nil]
619-
end
620-
|> Stream.map(&{nil, [&1]})
612+
%WriteQuery{} = write ->
613+
apply(Connection, function, [repo, write, opts])
614+
[nil]
615+
end
616+
|> Stream.map(&{nil, [&1]})
621617
end
622618

623619
@doc false
@@ -641,7 +637,7 @@ defmodule Mongo.Ecto do
641637
end
642638
end
643639

644-
def insert_all(repo, meta, fields, params, _, returning, opts) do
640+
def insert_all(repo, meta, _fields, params, _, _returning, opts) do
645641
normalized = NormalizedQuery.insert(meta, params)
646642

647643
case Connection.insert_all(repo, normalized, opts) do
@@ -654,7 +650,7 @@ defmodule Mongo.Ecto do
654650
end
655651

656652
@doc false
657-
def update(repo, meta, fields, filters, returning, opts) do
653+
def update(repo, meta, fields, filters, _returning, opts) do
658654
normalized = NormalizedQuery.update(meta, fields, filters)
659655

660656
Connection.update(repo, normalized, opts)

0 commit comments

Comments
 (0)