Skip to content

Commit 304cfd6

Browse files
committed
Add semgrep rule for Fun.id
1 parent af707f0 commit 304cfd6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.semgrep/fun.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rules:
2+
- id: fun-id
3+
pattern: fun $X -> $X
4+
message: use Fun.id instead
5+
languages: [ocaml]
6+
severity: WARNING

src/cdomains/exp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct
192192
let rec separate_fields_index o =
193193
match o with
194194
| NoOffset -> None
195-
| Index (ie,o) -> Some ((fun x -> x),ie,o)
195+
| Index (ie,o) -> Some (Fun.id,ie,o)
196196
| Field (f,o) ->
197197
match separate_fields_index o with
198198
| Some (osf, ie,o) -> Some ((fun o -> Field (f,o)), ie, o)

src/cdomains/mHP.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let pretty () {tid; created; must_joined} =
2323
else
2424
Some (Pretty.dprintf "must_joined=%a" ConcDomain.ThreadSet.pretty must_joined)
2525
in
26-
let docs = List.filter_map (fun doc -> doc) [tid_doc; created_doc; must_joined_doc] in
26+
let docs = List.filter_map Fun.id [tid_doc; created_doc; must_joined_doc] in
2727
Pretty.dprintf "{%a}" (Pretty.d_list "; " Pretty.insert) docs
2828

2929
include Printable.SimplePretty (

0 commit comments

Comments
 (0)