Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add noop_primitive_operations #2622

Merged
merged 1 commit into from
May 6, 2021
Merged

Conversation

a14n
Copy link
Contributor

@a14n a14n commented May 5, 2021

Follow up on #2618

Description

Some operations on primitive types are idempotent and can be removed.

BAD:

doubleValue.toDouble();

intValue.toInt();
intValue.round();
intValue.ceil();
intValue.floor();
intValue.truncate();

string.toString();
string = 'hello\n'
    'world\n'
    ''; // useless empty string

@google-cla google-cla bot added the cla: yes label May 5, 2021
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 94.306% when pulling 86aa11f on a14n:noop_primitive_operations into ba1b615 on dart-lang:master.

Copy link
Member

@pq pq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💎

@pq
Copy link
Member

pq commented May 5, 2021

Awesome. Love the generalization to noop_primitives... too. 👍

@a14n
Copy link
Contributor Author

a14n commented May 6, 2021

Awesome. Love the generalization to noop_primitives... too. 👍

Not sure to understand your comment. Do you suggest to rename the lint to noop_primitives_operations (plural for primitive) or were you talking about the merge of all noop_{int,double,string}_calls into this noop_primitive_operations?

@pq
Copy link
Member

pq commented May 6, 2021

Sorry, I was sloppy with my language. I meant to celebrate the merge. Good stuff!

@pq
Copy link
Member

pq commented May 6, 2021

@a14n : is this ready to land?

@a14n
Copy link
Contributor Author

a14n commented May 6, 2021

@a14n : is this ready to land?

Yes, thanks

@pq pq merged commit 5112f3c into dart-lang:master May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants