[refactor] Remove `then ()`

Reviewed By: jvillard

Differential Revision: D26978263

fbshipit-source-id: c7c684d4b
master
Ezgi Çiçek 4 years ago committed by Facebook GitHub Bot
parent 36135aed68
commit 432a970432

@ -338,8 +338,7 @@ and pp_template_spec_info pe f = function
and pp_protocols pe f protocols =
if List.is_empty protocols then ()
else
if not (List.is_empty protocols) then
F.fprintf f "%s%a%s" (escape pe "<")
(Pp.comma_seq (pp_name_c_syntax pe))
protocols (escape pe ">")

@ -280,8 +280,7 @@ and do_frontend_checks_via_transition linters context an trans =
and do_frontend_checks_decl linters (context : CLintersContext.context) decl =
let open Clang_ast_t in
if CAst_utils.is_implicit_decl decl then () (* do not analyze implicit declarations *)
else
if not (CAst_utils.is_implicit_decl decl) (* do not analyze implicit declarations *) then
let an = Ctl_parser_types.Decl decl in
(* The map should be visited when we enter the node before visiting children *)
match decl with

@ -59,8 +59,8 @@ let make sources =
let if_restart_scheduler f =
if Int.equal Config.jobs 1 then ()
else match Config.scheduler with File | SyntacticCallGraph -> () | Restart -> f ()
if not (Int.equal Config.jobs 1) then
match Config.scheduler with File | SyntacticCallGraph -> () | Restart -> f ()
type locked_proc =

@ -40,8 +40,8 @@ let pp_file_pos f (loc : t) = F.fprintf f "%a:%a" SourceFile.pp loc.file pp_shor
let pp_range f (loc_start, loc_end) =
let pp_end loc_start f loc_end =
if Int.equal loc_end.line loc_start.line then
if Int.equal loc_end.col loc_start.col then () else F.fprintf f "-%d" loc_end.col
if Int.equal loc_end.line loc_start.line then (
if not (Int.equal loc_end.col loc_start.col) then F.fprintf f "-%d" loc_end.col )
else F.fprintf f "-%a" pp_short loc_end
in
F.fprintf f "%a%a" pp_file_pos loc_start (pp_end loc_start) loc_end

@ -123,11 +123,10 @@ let marshal_to_pipe fd x =
(** like [Unix.read] but reads until [len] bytes have been read *)
let rec really_read ?(pos = 0) ~len fd ~buf =
if len <= 0 then ()
else
if len > 0 then (
let read = Unix.read ~pos ~len fd ~buf in
if Int.equal read 0 then raise End_of_file ;
really_read ~pos:(pos + read) ~len:(len - read) fd ~buf
really_read ~pos:(pos + read) ~len:(len - read) fd ~buf )
(** return a list of all updates coming from workers. The first update is expected for up to the

@ -617,8 +617,8 @@ let check_after_array_abstraction tenv prop =
| Predicates.Earray (_, esel, _) ->
(* check that no more than 2 elements are in the array *)
let typ_elem = Typ.array_elem (Some StdTyp.void) typ in
if List.length esel > 2 && array_typ_can_abstract typ then
if List.for_all ~f:(check_index root offs) esel then () else report_error prop
if List.length esel > 2 && array_typ_can_abstract typ then (
if not (List.for_all ~f:(check_index root offs) esel) then report_error prop )
else
List.iter
~f:(fun (ind, se) -> check_se root (offs @ [Predicates.Off_index ind]) typ_elem se)

@ -322,8 +322,7 @@ let pp_prop pe0 f prop =
F.fprintf f "@,@[<h>%a@]" (pp_hpara_dll_simple pe env n) hpara_dll
in
let pp_predicates _ () =
if Predicates.Env.is_empty env then ()
else (
if not (Predicates.Env.is_empty env) then (
F.fprintf f "@,where" ;
Predicates.Env.iter env iter_f iter_f_dll )
in

@ -87,8 +87,7 @@ let when_dominating_preds_satisfy idom my_node ~fun_name ~class_name_f ~f =
|> List.filter ~f:(fun node -> Dominators.dominates idom node my_node)
in
let rec aux node (counter : int) =
if Int.equal counter 0 then ()
else
if not (Int.equal counter 0) then
match preds node with
| [pred_node] -> (
match find_first_arg_pvar pred_node ~fun_name ~class_name_f with

@ -59,8 +59,7 @@ let process_getter_setter proc_name proc_desc =
| _ ->
[]
in
if List.is_empty getter_setter_instrs then ()
else
if not (List.is_empty getter_setter_instrs) then (
let new_attributes = {attributes with is_defined= true} in
Procdesc.set_attributes proc_desc new_attributes ;
let start_node = Procdesc.create_node proc_desc location Procdesc.Node.Start_node [] in
@ -73,7 +72,7 @@ let process_getter_setter proc_name proc_desc =
Procdesc.create_node proc_desc location node_kind getter_setter_instrs
in
Procdesc.node_set_succs proc_desc start_node ~normal:[getter_setter_node] ~exn:[] ;
Procdesc.node_set_succs proc_desc getter_setter_node ~normal:[exit_node] ~exn:[]
Procdesc.node_set_succs proc_desc getter_setter_node ~normal:[exit_node] ~exn:[] )
let process cfg = Procname.Hash.iter process_getter_setter cfg

@ -109,8 +109,7 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
CMethod_trans.create_local_procdesc ~set_objc_accessor_attr
~is_cpp_lambda_call_operator trans_unit_ctx cfg tenv ms body_new []
then
if is_cpp_lambda_call_operator && not inside_cpp_lambda_expr then ()
else
if (not is_cpp_lambda_call_operator) || inside_cpp_lambda_expr then
add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
None extra_instrs ~is_destructor_wrapper
in

@ -195,8 +195,7 @@ type control =
let pp_control fmt {root_nodes; leaf_nodes; instrs; initd_exps; cxx_temporary_markers_set} =
let pp_cxx_temporary_markers_set fmt =
if List.is_empty cxx_temporary_markers_set then ()
else
if not (List.is_empty cxx_temporary_markers_set) then
F.fprintf fmt ";@;cxx_temporary_markers_set=[%a]"
(Pp.seq ~sep:";" (Pvar.pp Pp.text))
cxx_temporary_markers_set

@ -110,8 +110,7 @@ let capture build_cmd =
let {command; rev_not_targets; targets} =
add_flavors_to_buck_arguments ClangFlavors ~extra_flavors:[] buck_args
in
if List.is_empty targets then ()
else
if not (List.is_empty targets) then (
let all_args = List.rev_append rev_not_targets targets in
let updated_buck_cmd =
command
@ -122,4 +121,4 @@ let capture build_cmd =
updated_buck_cmd ;
let prog, buck_build_cmd = (prog, updated_buck_cmd) in
ResultsDir.RunState.set_merge_capture true ;
clang_flavor_capture ~prog ~buck_build_cmd
clang_flavor_capture ~prog ~buck_build_cmd )

@ -99,15 +99,13 @@ end = struct
if Var.Map.is_empty vs then Q.pp_print fmt c
else
let pp_c fmt c =
if Q.is_zero c then ()
else
if not (Q.is_zero c) then
let plusminus, c_pos = if Q.geq c Q.zero then ('+', c) else ('-', Q.neg c) in
F.fprintf fmt " %c%a" plusminus Q.pp_print c_pos
in
let pp_coeff fmt q =
if Q.is_one q then ()
else if Q.is_minus_one q then F.pp_print_string fmt "-"
else F.fprintf fmt "%a·" Q.pp_print q
if not (Q.is_one q) then
if Q.is_minus_one q then F.pp_print_string fmt "-" else F.fprintf fmt "%a·" Q.pp_print q
in
let pp_vs fmt vs =
Pp.collection ~sep:" + "

Loading…
Cancel
Save