aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-10-27 20:50:20 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-13 11:06:10 +0900
commit3757d9027c612c88fdbf449eacf7f8f6c9b2e932 (patch)
tree1de46b20c94f661e375c27e54f367c846360d433 /lib/rubygems
parente6c84d05d0cfb9f20725716b93439746c697ce41 (diff)
downloadruby-3757d9027c612c88fdbf449eacf7f8f6c9b2e932.tar.gz
[rubygems/rubygems] Remove now unnecessary dups
https://github.com/rubygems/rubygems/commit/56ce2a6445
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/basic_specification.rb2
-rw-r--r--lib/rubygems/bundler_version_finder.rb2
-rw-r--r--lib/rubygems/config_file.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb5
-rw-r--r--lib/rubygems/name_tuple.rb2
-rw-r--r--lib/rubygems/path_support.rb2
-rw-r--r--lib/rubygems/request_set.rb2
-rw-r--r--lib/rubygems/specification.rb3
8 files changed, 8 insertions, 12 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 03fd07d284..d344bc5f3d 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -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
##
diff --git a/lib/rubygems/bundler_version_finder.rb b/lib/rubygems/bundler_version_finder.rb
index 14a4adf029..dd2fd77418 100644
--- a/lib/rubygems/bundler_version_finder.rb
+++ b/lib/rubygems/bundler_version_finder.rb
@@ -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)
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 5d4dcacb2f..1cad6af272 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -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|
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index a72b55a2da..bbd7852e92 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -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
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index 206083dc2f..3f4a6fcf3d 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -51,7 +51,7 @@ class Gem::NameTuple
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@platform}"
- end.dup
+ end
end
##
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index bde9ce2bde..5d34120072 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -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
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index d0a8d6081c..02b3477661 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -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, []
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 57bf41d29f..91d4408a16 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -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)