Apply Tidier suggestions

This commit is contained in:
Tuncer Ayaz 2011-08-20 18:33:36 +02:00
parent 8fb385f312
commit e6d1e13966
2 changed files with 11 additions and 12 deletions

View file

@ -291,15 +291,15 @@ cover_init(true, BeamFiles) ->
%% to stdout. If the cover server is already started we'll reuse that
%% pid.
{ok, CoverPid} = case cover:start() of
{ok, P} ->
{ok, P};
{ok, _P} = OkStart ->
OkStart;
{error,{already_started, P}} ->
{ok, P};
{error, Reason} ->
{error, Reason}
{error, _Reason} = ErrorStart ->
ErrorStart
end,
{ok, F} = file:open(
{ok, F} = OkOpen = file:open(
filename:join([?EUNIT_DIR, "cover.log"]),
[write]),
@ -327,7 +327,7 @@ cover_init(true, BeamFiles) ->
[Beam, Desc])
end,
_ = [PrintWarning(Beam, Desc) || {Beam, {error, Desc}} <- Compiled],
{ok, F}
OkOpen
end;
cover_init(Config, BeamFiles) ->
cover_init(rebar_config:get(Config, cover_enabled, false), BeamFiles).

View file

@ -187,13 +187,12 @@ expand_code_path() ->
%% The end of form $FOO is delimited with whitespace or eol
%%
expand_env_variable(InStr, VarName, RawVarValue) ->
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\",
[global, {return, list}]),
ReOpts = [global, {return, list}],
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts),
R1 = re:replace(InStr, "\\\$" ++ VarName ++ "\\s", VarValue ++ " ",
[global]),
R2 = re:replace(R1, "\\\$" ++ VarName ++ "\$", VarValue),
re:replace(R2, "\\\${" ++ VarName ++ "}", VarValue,
[global, {return, list}]).
re:replace(R2, "\\\${" ++ VarName ++ "}", VarValue, ReOpts).
%% ====================================================================