Skip to content

Commit

Permalink
remove nil checks from stub list iteration
Browse files Browse the repository at this point in the history
There should *never* be a nil value in the stub list, so we can stop
doing runtime nil checks on the stub object as we iterate.
  • Loading branch information
tenderlove committed Nov 9, 2015
1 parent 4cee8ca commit 0975003
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rubygems/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ def self.find_by_name name, *requirements
def self.find_by_path path
path = path.dup.freeze
stub = stubs.find { |spec|
spec.contains_requirable_file? path if spec
spec.contains_requirable_file? path
}
stub && stub.to_spec
end
Expand All @@ -1039,7 +1039,7 @@ def self.find_by_path path

def self.find_inactive_by_path path
stub = stubs.find { |s|
s.contains_requirable_file? path unless s.nil? || s.activated?
s.contains_requirable_file? path unless s.activated?
}
stub && stub.to_spec
end
Expand All @@ -1051,7 +1051,7 @@ def self.find_in_unresolved path
# TODO: do we need these?? Kill it
specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten

specs.find_all { |spec| spec.contains_requirable_file? path if spec }
specs.find_all { |spec| spec.contains_requirable_file? path }
end

##
Expand Down

0 comments on commit 0975003

Please sign in to comment.