summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralainfrisch <alain@frisch.fr>2016-01-20 00:02:30 +0100
committeralainfrisch <alain@frisch.fr>2016-01-20 00:02:30 +0100
commitae3af451b8fef6be5798e1136c6410de5301c1e8 (patch)
tree4a4324a7591949405dafcfbc13b2a55eed15b23d
parent09bc2670387b0efb2fcc6fffeb0295fcd6899cb2 (diff)
downloadocaml-ae3af451b8fef6be5798e1136c6410de5301c1e8.tar.gz
Remove useless bindings, use proper sequencing instead of 'let _ = ... in ...'.
-rw-r--r--ocamldoc/odoc_analyse.ml2
-rw-r--r--ocamldoc/odoc_args.ml5
-rw-r--r--ocamldoc/odoc_ast.ml44
-rw-r--r--ocamldoc/odoc_comments.ml9
-rw-r--r--ocamldoc/odoc_dag2html.ml18
-rw-r--r--ocamldoc/odoc_dep.ml31
-rw-r--r--ocamldoc/odoc_html.ml41
-rw-r--r--ocamldoc/odoc_lexer.mll3
-rw-r--r--ocamldoc/odoc_man.ml10
-rw-r--r--ocamldoc/odoc_ocamlhtml.mll5
-rw-r--r--ocamldoc/odoc_search.ml14
-rw-r--r--ocamldoc/odoc_sig.ml31
-rw-r--r--ocamldoc/odoc_text_lexer.mll9
-rw-r--r--ocamldoc/odoc_to_text.ml61
14 files changed, 117 insertions, 166 deletions
diff --git a/ocamldoc/odoc_analyse.ml b/ocamldoc/odoc_analyse.ml
index 3fdf2716fa..58e330069f 100644
--- a/ocamldoc/odoc_analyse.ml
+++ b/ocamldoc/odoc_analyse.ml
@@ -438,7 +438,7 @@ let analyse_files ?(init=[]) files =
print_string Odoc_messages.cross_referencing;
print_newline ()
);
- let _ = Odoc_cross.associate modules_list in
+ Odoc_cross.associate modules_list;
if !Odoc_global.verbose then
(
diff --git a/ocamldoc/odoc_args.ml b/ocamldoc/odoc_args.ml
index 8ce41c20f9..cdd6e1b993 100644
--- a/ocamldoc/odoc_args.ml
+++ b/ocamldoc/odoc_args.ml
@@ -399,10 +399,9 @@ let add_option o =
let parse () =
if modified_options () then append_last_doc "\n";
let options = !options @ !help_options in
- let _ = Arg.parse (Arg.align ~limit:13 options)
+ Arg.parse (Arg.align ~limit:13 options)
anonymous
- (M.usage^M.options_are)
- in
+ (M.usage^M.options_are);
(* we sort the hidden modules by name, to be sure that for example,
A.B is before A, so we will match against A.B before A in
Odoc_name.hide_modules.*)
diff --git a/ocamldoc/odoc_ast.ml b/ocamldoc/odoc_ast.ml
index 436c7502ec..284c3725ef 100644
--- a/ocamldoc/odoc_ast.ml
+++ b/ocamldoc/odoc_ast.ml
@@ -867,19 +867,16 @@ module Analyser =
tt_class_exp
table
in
- let cl =
- {
- cl_name = complete_name ;
- cl_info = comment_opt ;
- cl_type = cltype ;
- cl_virtual = virt ;
- cl_type_parameters = type_parameters ;
- cl_kind = kind ;
- cl_parameters = parameters ;
- cl_loc = { loc_impl = Some loc ; loc_inter = None } ;
- }
- in
- cl
+ {
+ cl_name = complete_name ;
+ cl_info = comment_opt ;
+ cl_type = cltype ;
+ cl_virtual = virt ;
+ cl_type_parameters = type_parameters ;
+ cl_kind = kind ;
+ cl_parameters = parameters ;
+ cl_loc = { loc_impl = Some loc ; loc_inter = None } ;
+ }
(** Get a name from a module expression, or "struct ... end" if the module expression
is not an ident of a constraint on an ident. *)
@@ -1043,18 +1040,15 @@ module Analyser =
[] ->
let s = get_string_of_file last_pos pos_limit in
let (_, ele_coms) = My_ir.all_special !file_name s in
- let ele_comments =
- List.fold_left
- (fun acc -> fun sc ->
- match sc.Odoc_types.i_desc with
- None ->
- acc
- | Some t ->
- acc @ [Element_module_comment t])
- []
- ele_coms
- in
- ele_comments
+ List.fold_left
+ (fun acc -> fun sc ->
+ match sc.Odoc_types.i_desc with
+ None ->
+ acc
+ | Some t ->
+ acc @ [Element_module_comment t])
+ []
+ ele_coms
| item :: q ->
let (comment_opt, ele_comments) =
get_comments_in_module last_pos item.Parsetree.pstr_loc.Location.loc_start.Lexing.pos_cnum
diff --git a/ocamldoc/odoc_comments.ml b/ocamldoc/odoc_comments.ml
index 236d860a37..b9fabbdf02 100644
--- a/ocamldoc/odoc_comments.ml
+++ b/ocamldoc/odoc_comments.ml
@@ -41,7 +41,7 @@ module Info_retriever =
let retrieve_info fun_lex file (s : string) =
try
- let _ = Odoc_comments_global.init () in
+ Odoc_comments_global.init ();
Odoc_lexer.comments_level := 0;
let lexbuf = Lexing.from_string s in
match Odoc_parser.main fun_lex lexbuf with
@@ -49,15 +49,14 @@ module Info_retriever =
(0, None)
| Some (desc, remain_opt) ->
let mem_nb_chars = !Odoc_comments_global.nb_chars in
- let _ =
- match remain_opt with
+ begin match remain_opt with
None ->
()
| Some s ->
(*DEBUG*)print_string ("remain: "^s); print_newline();
let lexbuf2 = Lexing.from_string s in
Odoc_parser.info_part2 Odoc_lexer.elements lexbuf2
- in
+ end;
(mem_nb_chars,
Some
{
@@ -138,7 +137,7 @@ module Info_retriever =
retrieve_info Odoc_lexer.main file s
let retrieve_info_simple file (s : string) =
- let _ = Odoc_comments_global.init () in
+ Odoc_comments_global.init ();
Odoc_lexer.comments_level := 0;
let lexbuf = Lexing.from_string s in
match Odoc_parser.main Odoc_lexer.simple lexbuf with
diff --git a/ocamldoc/odoc_dag2html.ml b/ocamldoc/odoc_dag2html.ml
index 74119e6e8b..9725d115a4 100644
--- a/ocamldoc/odoc_dag2html.ml
+++ b/ocamldoc/odoc_dag2html.ml
@@ -938,14 +938,16 @@ let tablify phony no_optim no_group d =
let t = {table = Array.append t.table [| Array.of_list new_row |]} in
let t =
if no_group && not (has_phony_children phony d t) then t
- else
- let _ = if no_optim then () else equilibrate t in
- let _ = group_elem t in
- let _ = group_ghost t in
- let _ = group_children t in
- let _ = group_span_by_common_children d t in
+ else begin
+ if no_optim then () else equilibrate t;
+ group_elem t;
+ group_ghost t;
+ group_children t;
+ group_span_by_common_children d t;
let t = if no_optim then t else treat_gaps d t in
- let _ = group_span_last_row t in t
+ group_span_last_row t;
+ t
+ end
in
loop t
in
@@ -1442,7 +1444,7 @@ let table_of_dag phony no_optim invert no_group d =
let d = if invert then invert_dag d else d in
let t = tablify phony no_optim no_group d in
let t = if invert then invert_table t else t in
- let _ = fall () t in
+ fall () t;
let t = fall2_right t in
let t = fall2_left t in
let t = shorten_too_long t in
diff --git a/ocamldoc/odoc_dep.ml b/ocamldoc/odoc_dep.ml
index ab027d8d40..1e598128b3 100644
--- a/ocamldoc/odoc_dep.ml
+++ b/ocamldoc/odoc_dep.ml
@@ -199,22 +199,19 @@ let kernel_deps_of_modules modules =
*)
let deps_of_types ?(kernel=false) types =
let deps_pre = List.map (fun t -> (t, type_deps t)) types in
- let deps =
- if kernel then
- (
- let graph = List.map
- (fun (t, names) -> Dep.make_node t.Type.ty_name names)
- deps_pre
- in
- let k = Dep.kernel graph in
- List.map
- (fun t ->
+ if kernel then
+ (
+ let graph = List.map
+ (fun (t, names) -> Dep.make_node t.Type.ty_name names)
+ deps_pre
+ in
+ let k = Dep.kernel graph in
+ List.map
+ (fun t ->
let node = Dep.get_node k t.Type.ty_name in
(t, Dep.set_to_list node.Dep.near)
- )
- types
- )
- else
- deps_pre
- in
- deps
+ )
+ types
+ )
+ else
+ deps_pre
diff --git a/ocamldoc/odoc_html.ml b/ocamldoc/odoc_html.ml
index 36ec40318a..65f0f81ff4 100644
--- a/ocamldoc/odoc_html.ml
+++ b/ocamldoc/odoc_html.ml
@@ -168,8 +168,7 @@ module Naming =
(** Return the complete filename for the code of the given value. *)
let file_code_value_complete_target v =
- let f = code_prefix^mark_value^(subst_infix_symbols v.val_name)^".html" in
- f
+ code_prefix^mark_value^(subst_infix_symbols v.val_name)^".html"
(** Return the link target for the given attribute. *)
let attribute_target a = target mark_attribute (Name.simple a.att_value.val_name)
@@ -179,8 +178,7 @@ module Naming =
(** Return the complete filename for the code of the given attribute. *)
let file_code_attribute_complete_target a =
- let f = code_prefix^mark_attribute^a.att_value.val_name^".html" in
- f
+ code_prefix^mark_attribute^a.att_value.val_name^".html"
(** Return the link target for the given method. *)
let method_target m = target mark_method (Name.simple m.met_value.val_name)
@@ -190,8 +188,7 @@ module Naming =
(** Return the complete filename for the code of the given method. *)
let file_code_method_complete_target m =
- let f = code_prefix^mark_method^m.met_value.val_name^".html" in
- f
+ code_prefix^mark_method^m.met_value.val_name^".html"
(** Return the link target for the given label section. *)
let label_target l = target "" l
@@ -202,20 +199,17 @@ module Naming =
(** Return the complete filename for the code of the type of the
given module or module type name. *)
let file_type_module_complete_target name =
- let f = type_prefix^name^".html" in
- f
+ type_prefix^name^".html"
(** Return the complete filename for the code of the
given module name. *)
let file_code_module_complete_target name =
- let f = code_prefix^name^".html" in
- f
+ code_prefix^name^".html"
(** Return the complete filename for the code of the type of the
given class or class type name. *)
let file_type_class_complete_target name =
- let f = type_prefix^name^".html" in
- f
+ type_prefix^name^".html"
end
module StringSet = Set.Make (struct
@@ -259,8 +253,7 @@ class virtual text =
method label_of_text t=
let t2 = Odoc_info.first_sentence_of_text t in
let s = Odoc_info.string_of_text t2 in
- let s2 = self#keep_alpha_num s in
- s2
+ self#keep_alpha_num s
(** Create a label for the associated title.
Return the label specified by the user or a label created
@@ -1176,12 +1169,10 @@ class html =
else
s_final
in
- let s2 = Str.global_substitute
- (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
- f
- s
- in
- s2
+ Str.global_substitute
+ (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
+ f
+ s
(** Take a string and return the string where fully qualified module idents
have been replaced by links to the module referenced by the ident.*)
@@ -1200,12 +1191,10 @@ class html =
else
s_final
in
- let s2 = Str.global_substitute
- (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\)\\(\\.[A-Z][a-zA-Z_'0-9]*\\)*")
- f
- s
- in
- s2
+ Str.global_substitute
+ (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\)\\(\\.[A-Z][a-zA-Z_'0-9]*\\)*")
+ f
+ s
(** Print html code to display a [Types.type_expr]. *)
method html_of_type_expr b m_name t =
diff --git a/ocamldoc/odoc_lexer.mll b/ocamldoc/odoc_lexer.mll
index 5993cb8fcd..bf5da3e23c 100644
--- a/ocamldoc/odoc_lexer.mll
+++ b/ocamldoc/odoc_lexer.mll
@@ -87,8 +87,7 @@ let remove_blanks s =
(** Remove first blank characters of each line of a string, until the first '*' *)
let remove_stars s =
- let s2 = Str.global_replace (Str.regexp ("^"^blank^"*\\*")) "" s in
- s2
+ Str.global_replace (Str.regexp ("^"^blank^"*\\*")) "" s
}
let lowercase = ['a'-'z' '\223'-'\246' '\248'-'\255' '_']
diff --git a/ocamldoc/odoc_man.ml b/ocamldoc/odoc_man.ml
index 3c85aa32ac..d2ee3f7501 100644
--- a/ocamldoc/odoc_man.ml
+++ b/ocamldoc/odoc_man.ml
@@ -355,12 +355,10 @@ class man =
match_s
(Name.get_relative m_name match_s)
in
- let s2 = Str.global_substitute
- (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
- f
- s
- in
- s2
+ Str.global_substitute
+ (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
+ f
+ s
(** Print groff string to display a [Types.type_expr].*)
method man_of_type_expr b m_name t =
diff --git a/ocamldoc/odoc_ocamlhtml.mll b/ocamldoc/odoc_ocamlhtml.mll
index 9b3ad2da18..04ca1c659b 100644
--- a/ocamldoc/odoc_ocamlhtml.mll
+++ b/ocamldoc/odoc_ocamlhtml.mll
@@ -198,8 +198,7 @@ let string_buffer = Buffer.create 32
let reset_string_buffer () = Buffer.reset string_buffer
let store_string_char = Buffer.add_char string_buffer
let get_stored_string () =
- let s = Buffer.contents string_buffer in
- s
+ Buffer.contents string_buffer
(** To translate escape sequences *)
@@ -517,7 +516,7 @@ let html_of_code b ?(with_pre=true) code =
try
print ~esc: false start ;
let lexbuf = Lexing.from_string code in
- let _ = token lexbuf in
+ token lexbuf;
print ~esc: false ending ;
Format.pp_print_flush !fmt () ;
Buffer.contents buf
diff --git a/ocamldoc/odoc_search.ml b/ocamldoc/odoc_search.ml
index 763b71602d..9e40ae3cbd 100644
--- a/ocamldoc/odoc_search.ml
+++ b/ocamldoc/odoc_search.ml
@@ -157,8 +157,7 @@ module Search =
[]
(Odoc_class.class_comments c)
in
- let l = res_att @ res_met @ res_sec in
- l
+ res_att @ res_met @ res_sec
else
[]
in
@@ -189,8 +188,7 @@ module Search =
[]
(Odoc_class.class_type_comments ct)
in
- let l = res_att @ res_met @ res_sec in
- l
+ res_att @ res_met @ res_sec
else
[]
in
@@ -252,10 +250,8 @@ module Search =
[]
(Odoc_module.module_type_comments mt)
in
- let l = res_val @ res_typ @ res_ext @ res_exc @ res_mod @
+ res_val @ res_typ @ res_ext @ res_exc @ res_mod @
res_modtyp @ res_cl @ res_cltyp @ res_sec
- in
- l
else
[]
in
@@ -317,10 +313,8 @@ module Search =
[]
(Odoc_module.module_comments m)
in
- let l = res_val @ res_typ @ res_ext @ res_exc @ res_mod @
+ res_val @ res_typ @ res_ext @ res_exc @ res_mod @
res_modtyp @ res_cl @ res_cltyp @ res_sec
- in
- l
else
[]
in
diff --git a/ocamldoc/odoc_sig.ml b/ocamldoc/odoc_sig.ml
index e246f01ff9..9d0f8b216f 100644
--- a/ocamldoc/odoc_sig.ml
+++ b/ocamldoc/odoc_sig.ml
@@ -136,8 +136,7 @@ module Analyser =
prepare_file must have been called to fill the file global variable.*)
let get_string_of_file the_start the_end =
try
- let s = String.sub !file the_start (the_end-the_start) in
- s
+ String.sub !file the_start (the_end-the_start)
with
Invalid_argument _ ->
""
@@ -501,14 +500,11 @@ module Analyser =
Parsetree.Pcty_constr (longident, _) ->
(*of Longident.t * core_type list*)
let name = Name.from_longident longident.txt in
- let ic =
- {
- ic_name = Odoc_env.full_class_or_class_type_name env name ;
- ic_class = None ;
- ic_text = text_opt ;
- }
- in
- ic
+ {
+ ic_name = Odoc_env.full_class_or_class_type_name env name ;
+ ic_class = None ;
+ ic_text = text_opt ;
+ }
| Parsetree.Pcty_signature _
| Parsetree.Pcty_arrow _ ->
@@ -1459,15 +1455,12 @@ module Analyser =
(Parsetree.Pcty_constr (_, _) (*of Longident.t * core_type list *),
Types.Cty_constr (p, typ_list, _) (*of Path.t * type_expr list * class_type*)) ->
print_DEBUG "Cty_constr _";
- let k =
- Class_type
- {
- cta_name = Odoc_env.full_class_or_class_type_name env (Name.from_path p) ;
- cta_class = None ;
- cta_type_parameters = List.map (Odoc_env.subst_type env) typ_list
- }
- in
- k
+ Class_type
+ {
+ cta_name = Odoc_env.full_class_or_class_type_name env (Name.from_path p) ;
+ cta_class = None ;
+ cta_type_parameters = List.map (Odoc_env.subst_type env) typ_list
+ }
| (Parsetree.Pcty_signature {
Parsetree.pcsig_fields = class_type_field_list;
diff --git a/ocamldoc/odoc_text_lexer.mll b/ocamldoc/odoc_text_lexer.mll
index bc339e72ce..b53a5a9de9 100644
--- a/ocamldoc/odoc_text_lexer.mll
+++ b/ocamldoc/odoc_text_lexer.mll
@@ -190,12 +190,11 @@ rule main = parse
if !verb_mode || !target_mode || !code_pre_mode ||
(!open_brackets >= 1) then
Char (Lexing.lexeme lexbuf)
- else
- let _ =
- if !ele_ref_mode then
- ele_ref_mode := false
- in
+ else begin
+ if !ele_ref_mode then
+ ele_ref_mode := false;
END
+ end
}
| begin_title
{
diff --git a/ocamldoc/odoc_to_text.ml b/ocamldoc/odoc_to_text.ml
index ce328b0dae..93aff00c81 100644
--- a/ocamldoc/odoc_to_text.ml
+++ b/ocamldoc/odoc_to_text.ml
@@ -96,13 +96,10 @@ class virtual info =
(** Return [text] value for the given "see also" reference. *)
method text_of_see (see_ref, t) =
- let t_ref =
- match see_ref with
- Odoc_info.See_url s -> [ Odoc_info.Link (s, t) ]
- | Odoc_info.See_file s -> (Odoc_info.Code s) :: (Odoc_info.Raw " ") :: t
- | Odoc_info.See_doc s -> (Odoc_info.Italic [Odoc_info.Raw s]) :: (Odoc_info.Raw " ") :: t
- in
- t_ref
+ match see_ref with
+ Odoc_info.See_url s -> [ Odoc_info.Link (s, t) ]
+ | Odoc_info.See_file s -> (Odoc_info.Code s) :: (Odoc_info.Raw " ") :: t
+ | Odoc_info.See_doc s -> (Odoc_info.Italic [Odoc_info.Raw s]) :: (Odoc_info.Raw " ") :: t
(** Return [text] value for the given list of "see also" references.*)
method text_of_sees l =
@@ -192,12 +189,10 @@ class virtual to_text =
let rel = Name.get_relative m_name match_s in
Odoc_info.apply_if_equal Odoc_info.use_hidden_modules match_s rel
in
- let s2 = Str.global_substitute
- (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
- f
- s
- in
- s2
+ Str.global_substitute
+ (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([a-z][a-zA-Z_'0-9]*\\)")
+ f
+ s
(** Take a string and return the string where fully qualified idents
have been replaced by idents relative to the given module name.
@@ -208,12 +203,10 @@ class virtual to_text =
let rel = Name.get_relative m_name match_s in
Odoc_info.apply_if_equal Odoc_info.use_hidden_modules match_s rel
in
- let s2 = Str.global_substitute
- (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([A-Z][a-zA-Z_'0-9]*\\)")
- f
- s
- in
- s2
+ Str.global_substitute
+ (Str.regexp "\\([A-Z]\\([a-zA-Z_'0-9]\\)*\\.\\)+\\([A-Z][a-zA-Z_'0-9]*\\)")
+ f
+ s
(** Get a string for a [Types.class_type] where all idents are relative. *)
method normal_class_type m_name t =
@@ -248,14 +241,12 @@ class virtual to_text =
(** @return [text] value to represent a [Types.type_expr].*)
method text_of_type_expr module_name t =
- let t = List.flatten
- (List.map
- (fun s -> [Code s ; Newline ])
- (Str.split (Str.regexp "\n")
- (self#normal_type module_name t))
- )
- in
- t
+ List.flatten
+ (List.map
+ (fun s -> [Code s ; Newline ])
+ (Str.split (Str.regexp "\n")
+ (self#normal_type module_name t))
+ )
(** Return [text] value for a given short [Types.type_expr].*)
method text_of_short_type_expr module_name t =
@@ -273,15 +264,13 @@ class virtual to_text =
(** @return [text] value to represent parameters of a class (with arraows).*)
method text_of_class_params module_name c =
- let t = Odoc_info.text_concat
- [Newline]
- (List.map
- (fun s -> [Code s])
- (Str.split (Str.regexp "\n")
- (self#normal_class_params module_name c))
- )
- in
- t
+ Odoc_info.text_concat
+ [Newline]
+ (List.map
+ (fun s -> [Code s])
+ (Str.split (Str.regexp "\n")
+ (self#normal_class_params module_name c))
+ )
(** @return [text] value to represent a [Types.module_type]. *)
method text_of_module_type t =