Skip to content

Files

Latest commit

 

History

History
28 lines (19 loc) · 513 Bytes

noop_primitive_operations.md

File metadata and controls

28 lines (19 loc) · 513 Bytes

Pattern: Use of no-op primitive operation

Issue: -

Description

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

Example of incorrect code:

doubleValue.toDouble();

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

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

Further Reading