diff options
| author | Markus Reiter | 2016-09-23 22:02:23 +0200 |
|---|---|---|
| committer | Markus Reiter | 2016-09-24 12:24:35 +0200 |
| commit | 58e36c73193befb57d351344cea2a4a33fef850d (patch) | |
| tree | 3d26751835440341e5a42a189cf580e6253785df /Library/Homebrew/extend/ENV | |
| parent | bbc3f1c3a852e6cfd26a7a7c333092fae0520eb4 (diff) | |
| download | brew-58e36c73193befb57d351344cea2a4a33fef850d.tar.bz2 | |
Fix Style/GuardClause.
Diffstat (limited to 'Library/Homebrew/extend/ENV')
| -rw-r--r-- | Library/Homebrew/extend/ENV/shared.rb | 16 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/std.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 12 |
3 files changed, 20 insertions, 23 deletions
diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 447e4dd29..909dc4f94 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -289,12 +289,11 @@ module SharedEnvExtension EOS end - unless gcc_formula.opt_prefix.exist? - raise <<-EOS.undent - The requested Homebrew GCC was not installed. You must: - brew install #{gcc_formula.full_name} - EOS - end + return if gcc_formula.opt_prefix.exist? + raise <<-EOS.undent + The requested Homebrew GCC was not installed. You must: + brew install #{gcc_formula.full_name} + EOS end def permit_arch_flags; end @@ -328,9 +327,8 @@ module SharedEnvExtension end def check_for_compiler_universal_support - if homebrew_cc =~ GNU_GCC_REGEXP - raise "Non-Apple GCC can't build universal binaries" - end + return unless homebrew_cc =~ GNU_GCC_REGEXP + raise "Non-Apple GCC can't build universal binaries" end def gcc_with_cxx11_support?(cc) diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 68bc9499d..b56aa56f3 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -48,10 +48,9 @@ module Stdenv send(compiler) - if cc =~ GNU_GCC_REGEXP - gcc_formula = gcc_version_formula($&) - append_path "PATH", gcc_formula.opt_bin.to_s - end + return unless cc =~ GNU_GCC_REGEXP + gcc_formula = gcc_version_formula($&) + append_path "PATH", gcc_formula.opt_bin.to_s end alias generic_setup_build_environment setup_build_environment @@ -174,10 +173,10 @@ module Stdenv append_to_cflags Hardware::CPU.universal_archs.as_arch_flags append "LDFLAGS", Hardware::CPU.universal_archs.as_arch_flags - if compiler != :clang && Hardware.is_32_bit? - # Can't mix "-march" for a 32-bit CPU with "-arch x86_64" - replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0") - end + return if compiler == :clang + return unless Hardware.is_32_bit? + # Can't mix "-march" for a 32-bit CPU with "-arch x86_64" + replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0") end def cxx11 diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 1c0271685..a3837c695 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -276,12 +276,12 @@ module Superenv self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags # GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64" - if compiler != :clang && Hardware::CPU.is_32_bit? - self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub( - /-march=\S*/, - "-Xarch_#{Hardware::CPU.arch_32_bit} \\0" - ) - end + return if compiler == :clang + return unless Hardware::CPU.is_32_bit? + self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub( + /-march=\S*/, + "-Xarch_#{Hardware::CPU.arch_32_bit} \\0" + ) end def permit_arch_flags |
