[Libguestfs] [PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.

Richard W.M. Jones rjones at redhat.com
Thu Oct 5 08:49:51 UTC 2017


On Wed, Oct 04, 2017 at 06:22:18PM +0200, Pino Toscano wrote:
> OOC, did you use a script to detect all these occurrences, or did you
> just manually scan through the code?

I grepped the code for /{.*;/ and manually rewrote those where
appropriate.

> > diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
> > index 5c5640c67..1be5941c1 100644
> > --- a/sysprep/sysprep_operation.ml
> > +++ b/sysprep/sysprep_operation.ml
> > @@ -172,7 +172,7 @@ let extra_args () =
> >    assert !baked;
> >  
> >    List.flatten (
> > -    List.map (fun { extra_args = extra_args } ->
> > +    List.map (fun { extra_args } ->
> >        List.map (fun { extra_argspec = argspec } -> argspec) extra_args
> 
> The last line here can be also simplified too?

Not directly, but it could become:

-      List.map (fun { extra_argspec = argspec } -> argspec) extra_args
+      List.map (fun { extra_argspec } -> extra_argspec) extra_args

which is slightly shorter.  I'll adjust this before pushing it.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list