[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 = and pp_protocols pe f protocols =
if List.is_empty protocols then () if not (List.is_empty protocols) then
else
F.fprintf f "%s%a%s" (escape pe "<") F.fprintf f "%s%a%s" (escape pe "<")
(Pp.comma_seq (pp_name_c_syntax pe)) (Pp.comma_seq (pp_name_c_syntax pe))
protocols (escape 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 = and do_frontend_checks_decl linters (context : CLintersContext.context) decl =
let open Clang_ast_t in let open Clang_ast_t in
if CAst_utils.is_implicit_decl decl then () (* do not analyze implicit declarations *) if not (CAst_utils.is_implicit_decl decl) (* do not analyze implicit declarations *) then
else
let an = Ctl_parser_types.Decl decl in let an = Ctl_parser_types.Decl decl in
(* The map should be visited when we enter the node before visiting children *) (* The map should be visited when we enter the node before visiting children *)
match decl with match decl with

@ -59,8 +59,8 @@ let make sources =
let if_restart_scheduler f = let if_restart_scheduler f =
if Int.equal Config.jobs 1 then () if not (Int.equal Config.jobs 1) then
else match Config.scheduler with File | SyntacticCallGraph -> () | Restart -> f () match Config.scheduler with File | SyntacticCallGraph -> () | Restart -> f ()
type locked_proc = 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_range f (loc_start, loc_end) =
let pp_end loc_start f 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.line loc_start.line then (
if Int.equal loc_end.col loc_start.col then () else F.fprintf f "-%d" loc_end.col 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 else F.fprintf f "-%a" pp_short loc_end
in in
F.fprintf f "%a%a" pp_file_pos loc_start (pp_end loc_start) loc_end 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 *) (** like [Unix.read] but reads until [len] bytes have been read *)
let rec really_read ?(pos = 0) ~len fd ~buf = let rec really_read ?(pos = 0) ~len fd ~buf =
if len <= 0 then () if len > 0 then (
else
let read = Unix.read ~pos ~len fd ~buf in let read = Unix.read ~pos ~len fd ~buf in
if Int.equal read 0 then raise End_of_file ; 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 (** 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, _) -> | Predicates.Earray (_, esel, _) ->
(* check that no more than 2 elements are in the array *) (* check that no more than 2 elements are in the array *)
let typ_elem = Typ.array_elem (Some StdTyp.void) typ in let typ_elem = Typ.array_elem (Some StdTyp.void) typ in
if List.length esel > 2 && array_typ_can_abstract typ then 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 not (List.for_all ~f:(check_index root offs) esel) then report_error prop )
else else
List.iter List.iter
~f:(fun (ind, se) -> check_se root (offs @ [Predicates.Off_index ind]) typ_elem se) ~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 F.fprintf f "@,@[<h>%a@]" (pp_hpara_dll_simple pe env n) hpara_dll
in in
let pp_predicates _ () = let pp_predicates _ () =
if Predicates.Env.is_empty env then () if not (Predicates.Env.is_empty env) then (
else (
F.fprintf f "@,where" ; F.fprintf f "@,where" ;
Predicates.Env.iter env iter_f iter_f_dll ) Predicates.Env.iter env iter_f iter_f_dll )
in 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) |> List.filter ~f:(fun node -> Dominators.dominates idom node my_node)
in in
let rec aux node (counter : int) = let rec aux node (counter : int) =
if Int.equal counter 0 then () if not (Int.equal counter 0) then
else
match preds node with match preds node with
| [pred_node] -> ( | [pred_node] -> (
match find_first_arg_pvar pred_node ~fun_name ~class_name_f with 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 in
if List.is_empty getter_setter_instrs then () if not (List.is_empty getter_setter_instrs) then (
else
let new_attributes = {attributes with is_defined= true} in let new_attributes = {attributes with is_defined= true} in
Procdesc.set_attributes proc_desc new_attributes ; Procdesc.set_attributes proc_desc new_attributes ;
let start_node = Procdesc.create_node proc_desc location Procdesc.Node.Start_node [] in 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 Procdesc.create_node proc_desc location node_kind getter_setter_instrs
in in
Procdesc.node_set_succs proc_desc start_node ~normal:[getter_setter_node] ~exn:[] ; 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 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 CMethod_trans.create_local_procdesc ~set_objc_accessor_attr
~is_cpp_lambda_call_operator trans_unit_ctx cfg tenv ms body_new [] ~is_cpp_lambda_call_operator trans_unit_ctx cfg tenv ms body_new []
then then
if is_cpp_lambda_call_operator && not inside_cpp_lambda_expr then () if (not is_cpp_lambda_call_operator) || inside_cpp_lambda_expr then
else
add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt
None extra_instrs ~is_destructor_wrapper None extra_instrs ~is_destructor_wrapper
in in

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

@ -110,8 +110,7 @@ let capture build_cmd =
let {command; rev_not_targets; targets} = let {command; rev_not_targets; targets} =
add_flavors_to_buck_arguments ClangFlavors ~extra_flavors:[] buck_args add_flavors_to_buck_arguments ClangFlavors ~extra_flavors:[] buck_args
in in
if List.is_empty targets then () if not (List.is_empty targets) then (
else
let all_args = List.rev_append rev_not_targets targets in let all_args = List.rev_append rev_not_targets targets in
let updated_buck_cmd = let updated_buck_cmd =
command command
@ -122,4 +121,4 @@ let capture build_cmd =
updated_buck_cmd ; updated_buck_cmd ;
let prog, buck_build_cmd = (prog, updated_buck_cmd) in let prog, buck_build_cmd = (prog, updated_buck_cmd) in
ResultsDir.RunState.set_merge_capture true ; 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 if Var.Map.is_empty vs then Q.pp_print fmt c
else else
let pp_c fmt c = let pp_c fmt c =
if Q.is_zero c then () if not (Q.is_zero c) then
else
let plusminus, c_pos = if Q.geq c Q.zero then ('+', c) else ('-', Q.neg c) in 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 F.fprintf fmt " %c%a" plusminus Q.pp_print c_pos
in in
let pp_coeff fmt q = let pp_coeff fmt q =
if Q.is_one q then () if not (Q.is_one q) then
else if Q.is_minus_one q then F.pp_print_string fmt "-" if Q.is_minus_one q then F.pp_print_string fmt "-" else F.fprintf fmt "%a·" Q.pp_print q
else F.fprintf fmt "%a·" Q.pp_print q
in in
let pp_vs fmt vs = let pp_vs fmt vs =
Pp.collection ~sep:" + " Pp.collection ~sep:" + "

Loading…
Cancel
Save