Skip to content

Commit

Permalink
Rust 1.83.0 rustc/clippy lint fixes
Browse files Browse the repository at this point in the history
Reviewed By: dtolnay

Differential Revision: D67226596

fbshipit-source-id: 23b4e975101dc5a3add60a223eee70ad69175f0e
  • Loading branch information
zertosh authored and facebook-github-bot committed Dec 14, 2024
1 parent 7b1323c commit b51a284
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ See `dotslash --help` for more information."
}

pub fn run_subcommand(subcommand: Subcommand, args: &mut ArgsOs) -> Result<(), SubcommandError> {
_run_subcommand(&subcommand, args).map_err(|x| SubcommandError::Other(subcommand, x))
run_subcommand_impl(&subcommand, args).map_err(|x| SubcommandError::Other(subcommand, x))
}

fn _run_subcommand(subcommand: &Subcommand, args: &mut ArgsOs) -> anyhow::Result<()> {
fn run_subcommand_impl(subcommand: &Subcommand, args: &mut ArgsOs) -> anyhow::Result<()> {
match subcommand {
Subcommand::B3Sum => {
let file_arg = take_exactly_one_arg(args)?;
Expand Down
6 changes: 3 additions & 3 deletions src/util/mv_no_clobber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::util::fs_ctx;
/// * Linux: renameat2 with RENAME_NOREPLACE flag
/// * macOS: renamex_np with RENAME_EXCL flag
pub fn mv_no_clobber<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
fn _mv_no_clobber(from: &Path, to: &Path) -> io::Result<()> {
fn mv_no_clobber_impl(from: &Path, to: &Path) -> io::Result<()> {
// If the destination already exists, do nothing.
if to.exists() {
return Ok(());
Expand All @@ -50,7 +50,7 @@ pub fn mv_no_clobber<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Resu
// then quickly clears up. This seems to happen when the system is
// under heavy load.
for wait in [1, 4, 9] {
match _mv_no_clobber(from.as_ref(), to.as_ref()) {
match mv_no_clobber_impl(from.as_ref(), to.as_ref()) {
Err(err) if err.kind() == io::ErrorKind::PermissionDenied => {
thread::sleep(Duration::from_secs(wait));
}
Expand All @@ -59,7 +59,7 @@ pub fn mv_no_clobber<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Resu
}
}

_mv_no_clobber(from.as_ref(), to.as_ref())
mv_no_clobber_impl(from.as_ref(), to.as_ref())
}

#[cfg(test)]
Expand Down
8 changes: 4 additions & 4 deletions src/util/tree_perms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::path::Path;

use crate::util::fs_ctx;

fn _make_tree_entries(folder: &Path, read_only: bool) -> io::Result<()> {
fn make_tree_entries_impl(folder: &Path, read_only: bool) -> io::Result<()> {
for entry in fs_ctx::read_dir(folder)? {
let entry = entry?;
let metadata = fs_ctx::symlink_metadata(entry.path())?;
Expand All @@ -21,7 +21,7 @@ fn _make_tree_entries(folder: &Path, read_only: bool) -> io::Result<()> {
continue;
}
if metadata.is_dir() {
_make_tree_entries(&entry.path(), read_only)?;
make_tree_entries_impl(&entry.path(), read_only)?;
}

let mut perms = metadata.permissions();
Expand All @@ -39,11 +39,11 @@ fn _make_tree_entries(folder: &Path, read_only: bool) -> io::Result<()> {
/// the permissions on the folder itself. Symlinks are not followed and no
/// attempt is made to change their permissions.
pub fn make_tree_entries_read_only(folder: &Path) -> io::Result<()> {
_make_tree_entries(folder, true)
make_tree_entries_impl(folder, true)
}

/// Like `make_tree_entries_read_only` but does the reverse - makes the
/// entries writable.
pub fn make_tree_entries_writable(folder: &Path) -> io::Result<()> {
_make_tree_entries(folder, false)
make_tree_entries_impl(folder, false)
}

0 comments on commit b51a284

Please sign in to comment.