Skip to content

Commit 7d79a46

Browse files
committed
Make unnecessary_to_owned clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 5b0de80 commit 7d79a46

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

download/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub mod curl {
162162
EASY.with(|handle| {
163163
let mut handle = handle.borrow_mut();
164164

165-
handle.url(&url.to_string())?;
165+
handle.url(url.as_ref())?;
166166
handle.follow_location(true)?;
167167

168168
if resume_from > 0 {

src/dist/dist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ fn try_update_from_dist_<'a>(
822822
let rust_package = m.get_package("rust")?;
823823
let rust_target_package = rust_package.get_target(Some(&toolchain.target.clone()))?;
824824

825-
for component in components.iter().copied() {
825+
for component in components {
826826
let mut component =
827827
Component::new(component.to_string(), Some(toolchain.target.clone()), false);
828828
if let Some(renamed) = m.rename_component(&component) {

src/dist/download.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'a> DownloadCfg<'a> {
5252
let cached_result = file_hash(&target_file, self.notify_handler)?;
5353
if hash == cached_result {
5454
(self.notify_handler)(Notification::FileAlreadyDownloaded);
55-
(self.notify_handler)(Notification::ChecksumValid(&url.to_string()));
55+
(self.notify_handler)(Notification::ChecksumValid(url.as_ref()));
5656
return Ok(File { path: target_file });
5757
} else {
5858
(self.notify_handler)(Notification::CachedFileChecksumFailed);
@@ -93,7 +93,7 @@ impl<'a> DownloadCfg<'a> {
9393
if hash != actual_hash {
9494
// Incorrect hash
9595
if partial_file_existed {
96-
self.clean(&[hash.to_string() + &".partial".to_string()])?;
96+
self.clean(&[hash.to_string() + ".partial"])?;
9797
Err(anyhow!(RustupError::BrokenPartialFile))
9898
} else {
9999
Err(RustupError::ChecksumFailed {
@@ -104,7 +104,7 @@ impl<'a> DownloadCfg<'a> {
104104
.into())
105105
}
106106
} else {
107-
(self.notify_handler)(Notification::ChecksumValid(&url.to_string()));
107+
(self.notify_handler)(Notification::ChecksumValid(url.as_ref()));
108108

109109
utils::rename_file(
110110
"downloaded",

tests/cli-misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn rustup_failed_path_search() {
325325
expect_err(
326326
config,
327327
broken,
328-
&"unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'".to_string(),
328+
"unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'",
329329
);
330330

331331
// Hardlink will be automatically cleaned up by test setup code

0 commit comments

Comments
 (0)