1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #31004 from shuheiktgw/remove_unnecessary_returns

Remove redundant return statements
This commit is contained in:
Rafael França 2017-10-31 01:47:35 -04:00 committed by GitHub
commit a8ebd48559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 16 additions and 16 deletions

View file

@ -198,7 +198,7 @@ end
class CacheHelperOutputBufferTest < BaseCachingTest class CacheHelperOutputBufferTest < BaseCachingTest
class MockController class MockController
def read_fragment(name, options) def read_fragment(name, options)
return false false
end end
def write_fragment(name, fragment, options) def write_fragment(name, fragment, options)

View file

@ -61,7 +61,7 @@ module ActionDispatch
return [status, headers, body] return [status, headers, body]
end end
return [404, { "X-Cascade" => "pass" }, ["Not Found"]] [404, { "X-Cascade" => "pass" }, ["Not Found"]]
end end
def recognize(rails_req) def recognize(rails_req)

View file

@ -317,7 +317,7 @@ end
class CacheHelperOutputBufferTest < ActionController::TestCase class CacheHelperOutputBufferTest < ActionController::TestCase
class MockController class MockController
def read_fragment(name, options) def read_fragment(name, options)
return false false
end end
def write_fragment(name, fragment, options) def write_fragment(name, fragment, options)

View file

@ -422,7 +422,7 @@ module ActionView
def to_s def to_s
value = @values[@index].to_s value = @values[@index].to_s
@index = next_index @index = next_index
return value value
end end
private private
@ -446,7 +446,7 @@ module ActionView
# uses an instance variable of ActionView::Base. # uses an instance variable of ActionView::Base.
def get_cycle(name) def get_cycle(name)
@_cycles = Hash.new unless defined?(@_cycles) @_cycles = Hash.new unless defined?(@_cycles)
return @_cycles[name] @_cycles[name]
end end
def set_cycle(name, cycle_object) def set_cycle(name, cycle_object)

View file

@ -77,7 +77,7 @@ module Delayed
self.locked_by = worker self.locked_by = worker
end end
return true true
end end
def self.db_time_now def self.db_time_now

View file

@ -236,7 +236,7 @@ module ActiveRecord
return has_attribute?(name) return has_attribute?(name)
end end
return true true
end end
# Returns +true+ if the given attribute is in the attributes hash, otherwise +false+. # Returns +true+ if the given attribute is in the attributes hash, otherwise +false+.

View file

@ -53,7 +53,7 @@ module ActiveRecord
unscoped.where(primary_key => object.id).update_all(updates) unscoped.where(primary_key => object.id).update_all(updates)
end end
return true true
end end
# A generic "counter updater" implementation, intended primarily to be # A generic "counter updater" implementation, intended primarily to be

View file

@ -113,7 +113,7 @@ module ActiveSupport
def append_features(base) def append_features(base)
if base.instance_variable_defined?(:@_dependencies) if base.instance_variable_defined?(:@_dependencies)
base.instance_variable_get(:@_dependencies) << self base.instance_variable_get(:@_dependencies) << self
return false false
else else
return false if base < self return false if base < self
@_dependencies.each { |dep| base.include(dep) } @_dependencies.each { |dep| base.include(dep) }

View file

@ -615,7 +615,7 @@ module ActiveSupport #:nodoc:
return false if desc.is_a?(Module) && desc.anonymous? return false if desc.is_a?(Module) && desc.anonymous?
name = to_constant_name desc name = to_constant_name desc
return false unless qualified_const_defined?(name) return false unless qualified_const_defined?(name)
return autoloaded_constants.include?(name) autoloaded_constants.include?(name)
end end
# Will the provided constant descriptor be unloaded? # Will the provided constant descriptor be unloaded?

View file

@ -118,7 +118,7 @@ module ActiveSupport
raise_parsing_error "(only last part can be fractional)" raise_parsing_error "(only last part can be fractional)"
end end
return true true
end end
end end
end end

View file

@ -55,7 +55,7 @@ module ActiveSupport
write.close write.close
result = read.read result = read.read
Process.wait2(pid) Process.wait2(pid)
return result.unpack("m")[0] result.unpack("m")[0]
end end
end end

View file

@ -6,22 +6,22 @@ require "active_support/core_ext/module/remove_method"
module RemoveMethodTests module RemoveMethodTests
class A class A
def do_something def do_something
return 1 1
end end
def do_something_protected def do_something_protected
return 1 1
end end
protected :do_something_protected protected :do_something_protected
def do_something_private def do_something_private
return 1 1
end end
private :do_something_private private :do_something_private
class << self class << self
def do_something_else def do_something_else
return 2 2
end end
end end
end end