Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jasha-hrp committed Sep 22, 2024
1 parent d3e6059 commit cd72d21
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test:
cargo test

fmt:
cargo fmt
cargo +nightly fmt

watch recipe *args:
watchexec --clear -e rs -- just {{ recipe }} {{ args }}
Expand Down
7 changes: 5 additions & 2 deletions src/checks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use std::path::Path;

use anyhow::Result;
use thiserror::Error;

#[derive(Error, Debug)]
Expand Down Expand Up @@ -62,11 +63,13 @@ pub(super) fn stow_directory_is_grandchild_of_common_ancestor(

#[cfg(test)]
mod tests {
use super::*;
use std::fs::File;
use std::os::unix::fs as unix_fs;

use tempfile::TempDir;

use super::*;

#[test]
fn test_stow_directory_is_grandchild_of_common_ancestor() {
let common_ancestor = Path::new("/home/user");
Expand Down
9 changes: 6 additions & 3 deletions src/command_impl.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//! This module contains the implementions for Commands that execute side effects to modify the
//! filesytem.
use anyhow::{Context, Result};
use fs_extra::dir::CopyOptions;
use std::path::{Path, PathBuf};
use std::process::Command as ProcessCommand;

use anyhow::{Context, Result};
use fs_extra::dir::CopyOptions;

/// Commands to execute side effects to modify the filesystem.
#[derive(Debug)]
pub(super) enum Command {
Expand Down Expand Up @@ -104,10 +105,12 @@ impl CommandImpl for Command {

#[cfg(test)]
mod tests {
use super::*;
use std::fs;

use tempfile::TempDir;

use super::*;

#[test]
fn test_create_directory() {
let temp_dir = TempDir::new().unwrap();
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@
//! ```
//! might be unwanted if the `.config` folder already contains some symlinks that point into the
mod checks;
mod command_impl;
mod util;
use std::path::{Path, PathBuf};

use anyhow::{Context, Result};
use clap::Parser;
use command_impl::Command;
use command_impl::CommandImpl;
use std::path::{Path, PathBuf};
use command_impl::{Command, CommandImpl};
use util::find_common_ancestor;

mod checks;
mod command_impl;
mod util;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
Expand Down
3 changes: 2 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ pub(super) fn find_common_ancestor(path1: &Path, path2: &Path) -> PathBuf {

#[cfg(test)]
mod tests {
use super::*;
use std::path::Path;

use super::*;

#[test]
fn test_find_common_ancestor_same_path() {
let path = Path::new("/home/user/documents");
Expand Down

0 comments on commit cd72d21

Please sign in to comment.