diff options
Diffstat (limited to 'crates/shirabe/src/repository')
9 files changed, 23 insertions, 47 deletions
diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs index ba085020..09c37766 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -59,7 +59,7 @@ impl ArrayRepository { FindPackageConstraint::Constraint(c) => c, FindPackageConstraint::String(s) => { let version_parser = VersionParser::new(); - version_parser.parse_constraints(&s).unwrap().clone() + version_parser.parse_constraints(&s).unwrap() } }; @@ -93,7 +93,7 @@ impl ArrayRepository { Some(FindPackageConstraint::Constraint(c)) => Some(c), Some(FindPackageConstraint::String(s)) => { let version_parser = VersionParser::new(); - Some(version_parser.parse_constraints(&s).unwrap().clone()) + Some(version_parser.parse_constraints(&s).unwrap()) } }; @@ -144,11 +144,7 @@ impl ArrayRepository { let aliased_package: Option<PackageHandle> = package.as_alias().map(|alias| alias.get_alias_of()); - self.packages - .borrow_mut() - .as_mut() - .unwrap() - .push(package.clone()); + self.packages.borrow_mut().as_mut().unwrap().push(package); if let Some(aliased_package) = aliased_package { // PHP: if ($aliasedPackage->getRepository() === null) $this->addPackage($aliasedPackage); diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs index fbee87d7..876ba3b8 100644 --- a/crates/shirabe/src/repository/composer_repository.rs +++ b/crates/shirabe/src/repository/composer_repository.rs @@ -2807,10 +2807,7 @@ impl ComposerRepository { .collect(); } - let mut response = self - .http_downloader - .borrow_mut() - .get(&filename, options.clone())?; + let mut response = self.http_downloader.borrow_mut().get(&filename, options)?; let mut json = response.get_body().unwrap_or("").to_string(); if let Some(sha256_val) = sha256 && sha256_val != hash("sha256", &json) @@ -3431,7 +3428,7 @@ impl RepositoryInterface for ComposerRepository { let name = strtolower(name); let constraint: AnyConstraint = match constraint { crate::repository::FindPackageConstraint::String(s) => { - self.version_parser.parse_constraints(&s)?.clone() + self.version_parser.parse_constraints(&s)? } crate::repository::FindPackageConstraint::Constraint(c) => c, }; @@ -3505,7 +3502,7 @@ impl RepositoryInterface for ComposerRepository { let constraint: Option<AnyConstraint> = match constraint { None => None, Some(crate::repository::FindPackageConstraint::String(s)) => { - Some(self.version_parser.parse_constraints(&s)?.clone()) + Some(self.version_parser.parse_constraints(&s)?) } Some(crate::repository::FindPackageConstraint::Constraint(c)) => Some(c), }; diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index 32fbcfd7..d4b9b72e 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -460,7 +460,7 @@ impl FilesystemRepository { "root".to_string(), PhpMixed::Array( self.dump_root_package( - current_root.clone(), + current_root, install_paths, dev_mode, repo_dir, @@ -602,11 +602,7 @@ impl FilesystemRepository { // PHP: ($package->getSourceReference() ?: $package->getDistReference()) ?: null; let source = package.get_source_reference().unwrap_or_default(); let dist = package.get_dist_reference().unwrap_or_default(); - let combined = if !source.is_empty() { - source.to_string() - } else { - dist.to_string() - }; + let combined = if !source.is_empty() { source } else { dist }; reference = if combined.is_empty() { None } else { @@ -630,11 +626,11 @@ impl FilesystemRepository { let mut data: IndexMap<String, PhpMixed> = IndexMap::new(); data.insert( "pretty_version".to_string(), - PhpMixed::String(package.get_pretty_version().to_string()), + PhpMixed::String(package.get_pretty_version()), ); data.insert( "version".to_string(), - PhpMixed::String(package.get_version().to_string()), + PhpMixed::String(package.get_version()), ); data.insert( "reference".to_string(), @@ -643,10 +639,7 @@ impl FilesystemRepository { None => PhpMixed::Null, }, ); - data.insert( - "type".to_string(), - PhpMixed::String(package.get_type().to_string()), - ); + data.insert("type".to_string(), PhpMixed::String(package.get_type())); data.insert( "install_path".to_string(), match install_path { @@ -687,10 +680,7 @@ impl FilesystemRepository { ); let mut result: IndexMap<String, PhpMixed> = IndexMap::new(); - result.insert( - "name".to_string(), - PhpMixed::String(package.get_name().to_string()), - ); + result.insert("name".to_string(), PhpMixed::String(package.get_name())); result.insert( "pretty_version".to_string(), data.get("pretty_version") diff --git a/crates/shirabe/src/repository/installed_repository.rs b/crates/shirabe/src/repository/installed_repository.rs index 9ed8d4e3..388670d4 100644 --- a/crates/shirabe/src/repository/installed_repository.rs +++ b/crates/shirabe/src/repository/installed_repository.rs @@ -120,7 +120,7 @@ impl InstalledRepository { let mut root_package: Option<BasePackageHandle> = None; for package in self.inner.get_packages()? { if package.as_root().is_some() { - root_package = Some(package.clone()); + root_package = Some(package); break; } } diff --git a/crates/shirabe/src/repository/platform_repository.rs b/crates/shirabe/src/repository/platform_repository.rs index 2b198c88..e4d93d3b 100644 --- a/crates/shirabe/src/repository/platform_repository.rs +++ b/crates/shirabe/src/repository/platform_repository.rs @@ -298,11 +298,8 @@ impl PlatformRepository { }) .unwrap_or(PhpMixed::Bool(false)); if has_inet6 || !matches!(inet_pton_check, PhpMixed::Bool(false)) { - let mut php_ipv6 = CompletePackage::new( - "php-ipv6".to_string(), - version.clone(), - pretty_version.clone(), - ); + let mut php_ipv6 = + CompletePackage::new("php-ipv6".to_string(), version, pretty_version); php_ipv6.set_description("The PHP interpreter, with IPv6 support".to_string()); self.add_package(CompletePackageHandle::from_complete_package(php_ipv6).into())?; } @@ -1700,7 +1697,7 @@ impl PlatformRepository { Link::new( "ext-uuid".to_string(), "lib-uuid".to_string(), - SimpleConstraint::new("=".to_string(), version.to_string(), None).into(), + SimpleConstraint::new("=".to_string(), version, None).into(), Some(Link::TYPE_REPLACE.to_string()), ext.get_pretty_version().to_string(), ), diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index 546dc72d..95d29938 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -363,7 +363,7 @@ impl GitBitbucketDriver { self.owner.clone(), self.repository.clone(), hash, - label.clone(), + label, )), ); } diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs index 22691b0c..d3d489f2 100644 --- a/crates/shirabe/src/repository/vcs/git_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_driver.rs @@ -438,7 +438,7 @@ impl GitDriver { )))); let mut git_util = GitUtil::new( io.clone(), - config.clone(), + config, process.clone(), std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None))), ); diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index b1cfd004..8d100755 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -136,12 +136,8 @@ impl GitLabDriver { "https".to_string() }; let port = match_.get(&CaptureKey::ByName("port".to_string())).cloned(); - let origin = Self::determine_origin( - &configured_domains, - guessed_domain, - &mut url_parts, - port.clone(), - ); + let origin = + Self::determine_origin(&configured_domains, guessed_domain, &mut url_parts, port); let origin = match origin { Some(o) => o, None => { diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs index ecf4a48a..3c233db8 100644 --- a/crates/shirabe/src/repository/vcs/svn_driver.rs +++ b/crates/shirabe/src/repository/vcs/svn_driver.rs @@ -268,7 +268,7 @@ impl SvnDriver { (identifier.clone(), String::new()) } } else { - (identifier.clone(), String::new()) + (identifier, String::new()) }; let output: String = match self.execute( @@ -308,7 +308,7 @@ impl SvnDriver { (identifier.clone(), String::new()) } } else { - (identifier.clone(), String::new()) + (identifier, String::new()) }; let output = self.execute( @@ -500,7 +500,7 @@ impl SvnDriver { "info".to_string(), "--non-interactive".to_string(), "--".to_string(), - url.clone(), + url, ], &mut ignored_output, None, |
