Skip to content

Remove unnecessary borrows #5413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/krate/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ fn verify_tarball(
// as `bar-0.1.0/` source code, and this could overwrite other crates in
// the registry!
let entry_path = entry.path()?;
if !entry_path.starts_with(&pkg_name) {
if !entry_path.starts_with(pkg_name) {
return Err(cargo_err("invalid tarball uploaded"));
}
if entry_path == vcs_info_path {
Expand Down
2 changes: 1 addition & 1 deletion src/email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ or go to https://{domain}/me/pending-invites to manage all of your crate ownersh
EmailBackend::FileSystem { path } => {
add_custom_metadata("email_backend", "fs");

let id = FileTransport::new(&path).send(&email).map_err(|err| {
let id = FileTransport::new(path).send(&email).map_err(|err| {
add_custom_metadata("email_error", err);
server_error("Email file could not be generated")
})?;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/builders/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl PublishBuilder {
);
body.extend(json.as_bytes().iter().cloned());

body.extend(&[
body.extend([
tarball.len() as u8,
(tarball.len() >> 8) as u8,
(tarball.len() >> 16) as u8,
Expand Down
2 changes: 1 addition & 1 deletion src/worker/dump_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Drop for DumpDirectory {

pub fn run_psql(script: &Path, database_url: &str) -> Result<(), PerformError> {
debug!(?script, "Running psql script…");
let psql_script = File::open(&script)?;
let psql_script = File::open(script)?;
let psql = std::process::Command::new("psql")
.arg(database_url)
.current_dir(script.parent().unwrap())
Expand Down
2 changes: 1 addition & 1 deletion src/worker/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub fn squash_index(env: &Environment) -> Result<(), PerformError> {

// Shell out to git because libgit2 does not currently support push leases

repo.run_command(Command::new("git").args(&[
repo.run_command(Command::new("git").args([
"push",
// Both updates should succeed or fail together
"--atomic",
Expand Down