Skip to content

Remove freeze on Regexp as it has no effect

Sincheol (David) Kim requested to merge remove-some-redundant-freeze into master

What does this MR do and why?

This MR removes some of the usage of freeze on Regexp objects as it still creates a new object and there are no destructive methods on Regexp that freeze can prevent. I'll remove the rest as well once this gets merged. FYI, it has been fixed by running rubocop with autocorrect option.

# freeze has no effect on regexp objects

[23] pry(main)> a = /abc/.freeze
=> /abc/
[24] pry(main)> b = /abc/.freeze
=> /abc/
[25] pry(main)> a.object_id
=> 223140
[26] pry(main)> b.object_id
=> 223160

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sincheol (David) Kim

Merge request reports

Loading