Skip to content

Commit

Permalink
os/mac/xcode: remove unnecessary type assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Sep 13, 2023
1 parent 4b7eec6 commit cf08039
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Library/Homebrew/os/mac/xcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,17 @@ def self.without_clt?
# directory or nil if Xcode.app is not installed.
sig { returns(T.nilable(Pathname)) }
def self.prefix
return @prefix if defined?(@prefix)

@prefix = T.let(@prefix, T.nilable(Pathname))
@prefix ||=
begin
dir = MacOS.active_developer_dir

if dir.empty? || dir == CLT::PKG_PATH || !File.directory?(dir)
path = bundle_path
path/"Contents/Developer" if path
else
# Use cleanpath to avoid pathological trailing slash
Pathname.new(dir).cleanpath
end
@prefix ||= begin
dir = MacOS.active_developer_dir

if dir.empty? || dir == CLT::PKG_PATH || !File.directory?(dir)
path = bundle_path
path/"Contents/Developer" if path
else
# Use cleanpath to avoid pathological trailing slash
Pathname.new(dir).cleanpath
end
end
end

sig { returns(Pathname) }
Expand Down

0 comments on commit cf08039

Please sign in to comment.