Skip to content

Commit 40bd48f

Browse files
committed
fix: Cargo format.
1 parent 9ebc086 commit 40bd48f

File tree

4 files changed

+62
-38
lines changed

4 files changed

+62
-38
lines changed

src/actions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ pub fn create_symlink(
269269
Ok(true)
270270
}
271271
SymlinkComparison::Identical => {
272-
warn!("Creating symlink {:?} -> {:?} but target already exists and points at source. Adding to cache anyways", source, target.target);
272+
warn!(
273+
"Creating symlink {:?} -> {:?} but target already exists and points at source. Adding to cache anyways",
274+
source, target.target
275+
);
273276
Ok(true)
274277
}
275278
SymlinkComparison::OnlyTargetExists | SymlinkComparison::BothMissing => {

src/deploy.rs

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::actions::{self, ActionRunner, RealActionRunner};
99
use crate::args::Options;
1010
use crate::config::{self, Cache, FileTarget, SymbolicTarget, TemplateTarget};
1111
use crate::display_error;
12-
use crate::filesystem::{self, load_file, Filesystem};
12+
use crate::filesystem::{self, Filesystem, load_file};
1313
use crate::handlebars_helpers::create_new_handlebars;
1414
use crate::hooks;
1515

@@ -135,7 +135,9 @@ Proceeding by copying instead of symlinking."
135135
// === Post-deploy ===
136136

137137
if suggest_force {
138-
error!("Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag.");
138+
error!(
139+
"Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag."
140+
);
139141
error_occurred = true;
140142
}
141143

@@ -223,7 +225,9 @@ pub fn undeploy(opt: &Options) -> Result<bool> {
223225
// === Post-undeploy ===
224226

225227
if suggest_force {
226-
error!("Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag.");
228+
error!(
229+
"Some files were skipped. To ignore errors and overwrite unexpected target files, use the --force flag."
230+
);
227231
error_occurred = true;
228232
}
229233

@@ -780,16 +784,20 @@ mod test {
780784
opt.force,
781785
opt.diff_context_lines,
782786
);
783-
assert!(runner
784-
.create_symlink(&PathBuf::from("a_in"), &PathBuf::from("a_out").into())
785-
.unwrap());
786-
assert!(runner
787-
.create_template(
788-
&PathBuf::from("b_in"),
789-
&PathBuf::from("cache/b_cache"),
790-
&PathBuf::from("b_out").into(),
791-
)
792-
.unwrap());
787+
assert!(
788+
runner
789+
.create_symlink(&PathBuf::from("a_in"), &PathBuf::from("a_out").into())
790+
.unwrap()
791+
);
792+
assert!(
793+
runner
794+
.create_template(
795+
&PathBuf::from("b_in"),
796+
&PathBuf::from("cache/b_cache"),
797+
&PathBuf::from("b_out").into(),
798+
)
799+
.unwrap()
800+
);
793801
}
794802

795803
#[test]
@@ -830,15 +838,19 @@ mod test {
830838
);
831839

832840
// Both should skip
833-
assert!(!runner
834-
.create_symlink(&PathBuf::from("a_in"), &PathBuf::from("a_out").into())
835-
.unwrap());
836-
assert!(!runner
837-
.create_template(
838-
&PathBuf::from("b_in"),
839-
&PathBuf::from("cache/b_cache"),
840-
&PathBuf::from("b_out").into(),
841-
)
842-
.unwrap());
841+
assert!(
842+
!runner
843+
.create_symlink(&PathBuf::from("a_in"), &PathBuf::from("a_out").into())
844+
.unwrap()
845+
);
846+
assert!(
847+
!runner
848+
.create_template(
849+
&PathBuf::from("b_in"),
850+
&PathBuf::from("cache/b_cache"),
851+
&PathBuf::from("b_out").into(),
852+
)
853+
.unwrap()
854+
);
843855
}
844856
}

src/filesystem.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ impl RealFilesystem {
248248
if !self.sudo_occurred {
249249
warn!("Elevating permissions ({})", goal.as_ref());
250250
if !log_enabled!(log::Level::Debug) {
251-
warn!("To see more than the first time elevated permissions are used, use verbosity 2 or more (-vv)");
251+
warn!(
252+
"To see more than the first time elevated permissions are used, use verbosity 2 or more (-vv)"
253+
);
252254
}
253255
self.sudo_occurred = true;
254256
} else {
@@ -825,7 +827,10 @@ pub fn is_template(source: &Path) -> Result<bool> {
825827
let mut buf = String::new();
826828

827829
if file.read_to_string(&mut buf).is_err() {
828-
warn!("File {:?} is not valid UTF-8 - detecting as symlink. Explicitly specify it to silence this message.", source);
830+
warn!(
831+
"File {:?} is not valid UTF-8 - detecting as symlink. Explicitly specify it to silence this message.",
832+
source
833+
);
829834
Ok(false)
830835
} else {
831836
Ok(buf.contains("{{"))

src/handlebars_helpers.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,14 @@ mod test {
386386
assert!(
387387
!eval_condition(&handlebars, &config.variables, "dotter.packages.nonexist").unwrap()
388388
);
389-
assert!(!eval_condition(
390-
&handlebars,
391-
&config.variables,
392-
"(and true dotter.packages.disabled)"
393-
)
394-
.unwrap());
389+
assert!(
390+
!eval_condition(
391+
&handlebars,
392+
&config.variables,
393+
"(and true dotter.packages.disabled)"
394+
)
395+
.unwrap()
396+
);
395397
}
396398

397399
#[test]
@@ -407,12 +409,14 @@ mod test {
407409
};
408410
let handlebars = create_new_handlebars(&mut config).unwrap();
409411

410-
assert!(!eval_condition(
411-
&handlebars,
412-
&config.variables,
413-
"(is_executable \"no_such_executable_please\")"
414-
)
415-
.unwrap());
412+
assert!(
413+
!eval_condition(
414+
&handlebars,
415+
&config.variables,
416+
"(is_executable \"no_such_executable_please\")"
417+
)
418+
.unwrap()
419+
);
416420
assert!(
417421
eval_condition(&handlebars, &config.variables, "(eq (math \"5+5\") \"10\")").unwrap()
418422
);

0 commit comments

Comments
 (0)