lib/rubocop/cop/style/and_or.rb in rubocop-0.21.0 vs lib/rubocop/cop/style/and_or.rb in rubocop-0.22.0
- old
+ new
@@ -22,15 +22,12 @@
private
def process_logical_op(node)
op = node.loc.operator.source
op_type = node.type.to_s
+ return unless op == op_type
- if op == op_type
- add_offense(node,
- :operator,
- format(MSG, OPS[op], op))
- end
+ add_offense(node, :operator, format(MSG, OPS[op], op))
end
def correction(node)
lambda do |corrector|
replacement = (node.type == :and ? '&&' : '||')