Skip to content

Commit

Permalink
Add semgrep rule for Fun.id
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Feb 17, 2022
1 parent af707f0 commit 304cfd6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .semgrep/fun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rules:
- id: fun-id
pattern: fun $X -> $X
message: use Fun.id instead
languages: [ocaml]
severity: WARNING
2 changes: 1 addition & 1 deletion src/cdomains/exp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct
let rec separate_fields_index o =
match o with
| NoOffset -> None
| Index (ie,o) -> Some ((fun x -> x),ie,o)
| Index (ie,o) -> Some (Fun.id,ie,o)
| Field (f,o) ->
match separate_fields_index o with
| Some (osf, ie,o) -> Some ((fun o -> Field (f,o)), ie, o)
Expand Down
2 changes: 1 addition & 1 deletion src/cdomains/mHP.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let pretty () {tid; created; must_joined} =
else
Some (Pretty.dprintf "must_joined=%a" ConcDomain.ThreadSet.pretty must_joined)
in
let docs = List.filter_map (fun doc -> doc) [tid_doc; created_doc; must_joined_doc] in
let docs = List.filter_map Fun.id [tid_doc; created_doc; must_joined_doc] in
Pretty.dprintf "{%a}" (Pretty.d_list "; " Pretty.insert) docs

include Printable.SimplePretty (
Expand Down

0 comments on commit 304cfd6

Please sign in to comment.