From af11ff99a6cf55ad23f0e360129049aec8e7702c Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Wed, 29 Jun 2016 22:10:36 +0200 Subject: [PATCH] Avoid warning with Elixir 1.3.1 Compiling 2 files (.ex) warning: the variable "log" is unsafe as it has been set inside a case/cond/receive/if/&&/||. Please explicitly return the variable value instead. For example: case int do 1 -> atom = :one 2 -> atom = :two end should be written as atom = case int do 1 -> :one 2 -> :two end Unsafe variable found at: lib/ex_syslog.ex:35 --- lib/ex_syslog.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ex_syslog.ex b/lib/ex_syslog.ex index a59e223..7b0c523 100644 --- a/lib/ex_syslog.ex +++ b/lib/ex_syslog.ex @@ -24,12 +24,12 @@ defmodule ExSyslog do %{name: name, log: log, config: config} = state) do new_config = get_config(name, options) - if config.facility !== new_config.facility or + {:ok, log} = if config.facility !== new_config.facility or config.ident !== new_config.ident or config.option !== new_config.option do close_log(log) - {:ok, log} = open_log(new_config) + open_log(new_config) end new_state = %{state | log: log, config: new_config}