diff options
author | Kostis Sagonas <[email protected]> | 2010-02-08 10:29:31 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-02-10 08:25:43 +0100 |
commit | 48654b06afc07dba4342e02293b9adb9776d99d1 (patch) | |
tree | 76c798ef2d949b850833610af6813ab971d0a447 /lib/stdlib/src/qlc_pt.erl | |
parent | 19fda3d8ddbd8b844024bd15689dbf45fa8e5e1e (diff) | |
download | otp-48654b06afc07dba4342e02293b9adb9776d99d1.tar.gz otp-48654b06afc07dba4342e02293b9adb9776d99d1.tar.bz2 otp-48654b06afc07dba4342e02293b9adb9776d99d1.zip |
stdlib: clean up as suggested by tidier
Hans Bolinder (the author/maintainer of qlc) prefers
for readability reasons to use length/1 in a guard
when it is known that the list is guaranteed to be
short, so the change suggested by tidier for line 875
of qlc_pt has not been included.
Diffstat (limited to 'lib/stdlib/src/qlc_pt.erl')
-rw-r--r-- | lib/stdlib/src/qlc_pt.erl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/stdlib/src/qlc_pt.erl b/lib/stdlib/src/qlc_pt.erl index 2d7874d99f..a72fe8639e 100644 --- a/lib/stdlib/src/qlc_pt.erl +++ b/lib/stdlib/src/qlc_pt.erl @@ -845,8 +845,8 @@ join_handle(AP, L, [F, H, O, C], Constants) -> join_handle_constants(QId, ExtraConstants) -> IdNo = QId#qid.no, - case lists:keysearch(IdNo, 1, ExtraConstants) of - {value, {IdNo, ConstOps}} -> + case lists:keyfind(IdNo, 1, ExtraConstants) of + {IdNo, ConstOps} -> ConstOps; false -> [] @@ -1231,9 +1231,9 @@ lu_skip(ColConstants, FilterData, PatternFrame, PatternVars, %% The filter can only be skipped if all constants %% are looked up. LookedUpConstants = - case lists:keysearch(Column, 1, ColConstants) of + case lists:keyfind(Column, 1, ColConstants) of false -> []; - {value, {Column,LUCs}} -> LUCs + {Column, LUCs} -> LUCs end, %% Don't try to handle filters that compare several %% values equal. See also frames_to_columns(). @@ -1279,8 +1279,8 @@ join_gens(Cs0, Qs, Skip) -> join_gens2(lists:filter(fun(C) -> length(C) > 2 end, Cs), FD, Skip)}. join_gens2(Cs0, FilterData, Skip) -> - [{J, skip_tag(case lists:keysearch(J, 1, Skip) of - {value, {J,FilL}} -> + [{J, skip_tag(case lists:keyfind(J, 1, Skip) of + {J, FilL} -> FilL; false -> [] @@ -1296,8 +1296,8 @@ skip_tag(FilList, FilterData) -> end, FilList}. skip_tag(Col, ColFils, FilterData) -> - case lists:keysearch(Col, 1, ColFils) of - {value, {Col, FilL}} -> + case lists:keyfind(Col, 1, ColFils) of + {Col, FilL} -> Tag = if length(FilterData) =:= length(FilL) -> all; @@ -1415,7 +1415,7 @@ sel_gf([], _N, _Deps, _RDs, _Gens, _Gens1) -> sel_gf([{#qid{no = N}=Id,{fil,F}}=Fil | FData], N, Deps, RDs, Gens, Gens1) -> case erl_lint:is_guard_test(F, RDs) of true -> - {value, {Id,GIds}} = lists:keysearch(Id, 1, Deps), + {Id,GIds} = lists:keyfind(Id, 1, Deps), case length(GIds) =< 1 of true -> case generators_in_scope(GIds, Gens1) of @@ -2572,8 +2572,8 @@ nos_pattern([P0 | Ps0], S0, PVs0) -> {[P | Ps], S, PVs}; nos_pattern({var,L,V}, {LI,Vs0,UV,A,Sg}, PVs0) when V =/= '_' -> {Name, Vs, PVs} = - case lists:keysearch(V, 1, PVs0) of - {value, {V,VN}} -> + case lists:keyfind(V, 1, PVs0) of + {V, VN} -> _ = used_var(V, Vs0, UV), {VN, Vs0, PVs0}; false -> |