From eb75295eb95602d0930ce9070447537b7ace22df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 29 Jan 2016 12:47:17 +0100 Subject: Eliminate redundant double is_function test When tuple funs were still supported, the idiom for allowing real funs with a certain arity but not tuple funs was: is_function(Fun) andalso is_function(Fun, Arity) The reason that both tests were needed is because: is_function({M,F}) would return 'false' is_function({M,F}, Arity) would return 'true' In 53ec991d19, is_function/2 was updated to only return 'false' for tuples, so the call to is_function/1 can be removed. --- lib/stdlib/src/beam_lib.erl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/stdlib/src/beam_lib.erl') diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl index 6e00401dce..46aaf84d35 100644 --- a/lib/stdlib/src/beam_lib.erl +++ b/lib/stdlib/src/beam_lib.erl @@ -972,9 +972,7 @@ handle_call({get_crypto_key, What}, From, #state{crypto_key_f=F}=S) -> handle_call({crypto_key_fun, F}, {_,_} = From, S) -> case S#state.crypto_key_f of undefined -> - %% Don't allow tuple funs here. (They weren't allowed before, - %% so there is no reason to allow them now.) - if is_function(F), is_function(F, 1) -> + if is_function(F, 1) -> {Result, Fun, Reply} = case catch F(init) of ok -> -- cgit v1.2.3