[rubygems/rubygems] Remove now unnecessary dups

https://github.com/rubygems/rubygems/commit/56ce2a6445
This commit is contained in:
David Rodríguez 2023-10-27 20:50:20 +02:00 committed by Hiroshi SHIBATA
parent e6c84d05d0
commit 3757d9027c
8 changed files with 8 additions and 12 deletions

View File

@ -293,7 +293,7 @@ class Gem::BasicSpecification
"lib" # default value for require_paths for bundler/inline
end
"#{full_gem_path}/#{dirs}".dup
"#{full_gem_path}/#{dirs}"
end
##

View File

@ -67,7 +67,7 @@ module Gem::BundlerVersionFinder
lockfile = case gemfile
when "gems.rb" then "gems.locked"
else "#{gemfile}.lock"
end.dup
end
return unless File.file?(lockfile)

View File

@ -188,7 +188,7 @@ class Gem::ConfigFile
operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
system_config = load_file SYSTEM_WIDE_CONFIG_FILE
user_config = load_file config_file_name.dup
user_config = load_file config_file_name
environment_config = (ENV["GEMRC"] || "").
split(File::PATH_SEPARATOR).inject({}) do |result, file|

View File

@ -46,12 +46,11 @@ module Kernel
load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
Gem.suffixes.find do |s|
$LOAD_PATH[0...load_path_check_index].find do |lp|
safe_lp = lp.dup
if File.symlink? safe_lp # for backward compatibility
if File.symlink? lp # for backward compatibility
next
end
full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
full_path = File.expand_path(File.join(lp, "#{path}#{s}"))
rp = full_path if File.file?(full_path)
end
end

View File

@ -51,7 +51,7 @@ class Gem::NameTuple
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@platform}"
end.dup
end
end
##

View File

@ -47,8 +47,6 @@ class Gem::PathSupport
@path = split_gem_path env["GEM_PATH"], @home
@spec_cache_dir = env["GEM_SPEC_CACHE"] || Gem.default_spec_cache_dir
@spec_cache_dir = @spec_cache_dir.dup
end
private

View File

@ -324,7 +324,7 @@ class Gem::RequestSet
@git_set.root_dir = @install_dir
lock_file = "#{File.expand_path(path)}.lock".dup
lock_file = "#{File.expand_path(path)}.lock"
begin
tokenizer = Gem::RequestSet::Lockfile::Tokenizer.from_file lock_file
parser = tokenizer.make_parser self, []

View File

@ -969,7 +969,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.dirs
@@dirs ||= Gem.path.collect do |dir|
File.join dir.dup, "specifications"
File.join dir, "specifications"
end
end
@ -1162,7 +1162,6 @@ class Gem::Specification < Gem::BasicSpecification
spec = @load_cache_mutex.synchronize { @load_cache[file] }
return spec if spec
file = file.dup
return unless File.file?(file)
code = Gem.open_file(file, "r:UTF-8:-", &:read)