File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,9 @@ let _ =
38
38
let r =
39
39
let * bridge = if ! bridge = " " then Error Skip else Ok ! bridge in
40
40
let * bridge_config =
41
- match List. assoc_opt bridge config.bridge_config with
42
- | Some bridge_config ->
43
- Ok bridge_config
44
- | None ->
45
- Error (Msg (Printf. sprintf " Could not find bridge %s\n " bridge))
41
+ let error = Msg (Printf. sprintf " Could not find bridge %s\n " bridge) in
42
+ List. assoc_opt bridge config.bridge_config
43
+ |> Option. to_result ~none: error
46
44
in
47
45
let ifaces =
48
46
List. concat_map (fun (_ , port ) -> port.interfaces) bridge_config.ports
@@ -78,11 +76,10 @@ let _ =
78
76
in
79
77
Printf. printf " interfaces=%s\n " (String. concat " ," ifaces) ;
80
78
Printf. printf " hwaddrs=%s\n " (String. concat " ," macs) ;
81
- match bridge_config.vlan with
82
- | None ->
83
- Ok ()
84
- | Some (parent , id ) ->
85
- Ok (Printf. printf " vlan=%d\n parent=%s\n " id parent)
79
+ Option. iter
80
+ (fun (parent , id ) -> Printf. printf " vlan=%d\n parent=%s\n " id parent)
81
+ bridge_config.vlan ;
82
+ Ok ()
86
83
in
87
84
( match r with
88
85
| Ok () | Error Skip ->
You can’t perform that action at this time.
0 commit comments