Remove useless casting to the same type - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Remove useless casting to the same type
Date
Msg-id aSQy2JawavlVlEB0@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
Responses Re: Remove useless casting to the same type
Re: Remove useless casting to the same type
List pgsql-hackers
Hi hackers,

Attached is a patch to $SUBJECT.

This is the same kind of idea as 7f798aca1d5 and ef8fe693606, as their presence
could cause risks of hiding actual type mismatches in the future or silently
discarding qualifiers. I think that it also improves readability.

Those have been found with a coccinelle script as:

"
@@
type T;
T E;
@@

- (T)
  E
"

which removes casts when it's casting to the same type.

Note that it generated more that what is in the attached. I chose not to remove
some of them (mainly arithmetic ones) to keep the patch focused on what matters
here.

Thoughts?

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: get rid of Pointer type, mostly
Next
From: Michael Paquier
Date:
Subject: Re: make -C src/test/isolation failure in index-killtuples due to btree_gist