Skip to content

Commit 9cf2808

Browse files
committed
chore: run cargo fmt
1 parent 745b0f5 commit 9cf2808

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

rewatch/src/build/compile.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,10 @@ fn compile_file(
669669
}
670670

671671
if let SourceType::SourceFile(SourceFile {
672-
interface: Some(Interface { path, .. }),
673-
..
674-
}) = &module.source_type {
672+
interface: Some(Interface { path, .. }),
673+
..
674+
}) = &module.source_type
675+
{
675676
// we need to copy the source file to the build directory.
676677
// editor tools expects the source file in lib/bs for finding the current package
677678
// and in lib/ocaml when referencing modules in other packages
@@ -690,9 +691,10 @@ fn compile_file(
690691
.expect("copying source file failed");
691692
}
692693
if let SourceType::SourceFile(SourceFile {
693-
implementation: Implementation { path, .. },
694-
..
695-
}) = &module.source_type {
694+
implementation: Implementation { path, .. },
695+
..
696+
}) = &module.source_type
697+
{
696698
// we need to copy the source file to the build directory.
697699
// editor tools expects the source file in lib/bs for finding the current package
698700
// and in lib/ocaml when referencing modules in other packages
@@ -715,9 +717,10 @@ fn compile_file(
715717
root_package.config.get_package_specs().iter().for_each(|spec| {
716718
if spec.in_source {
717719
if let SourceType::SourceFile(SourceFile {
718-
implementation: Implementation { path, .. },
719-
..
720-
}) = &module.source_type {
720+
implementation: Implementation { path, .. },
721+
..
722+
}) = &module.source_type
723+
{
721724
let source = helpers::get_source_file_from_rescript_file(
722725
&Path::new(&package.path).join(path),
723726
&root_package.config.get_suffix(spec),
@@ -728,8 +731,7 @@ fn compile_file(
728731
);
729732

730733
if source.exists() {
731-
let _ =
732-
std::fs::copy(&source, &destination).expect("copying source file failed");
734+
let _ = std::fs::copy(&source, &destination).expect("copying source file failed");
733735
}
734736
}
735737
}

rewatch/src/build/deps.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ fn get_dep_modules(
5252
.cloned()
5353
.collect();
5454

55-
deps
56-
.iter()
55+
deps.iter()
5756
.map(|dep| {
5857
let dep_first = dep.split('.').next().unwrap();
5958
let dep_second = dep.split('.').nth(1);

rewatch/src/helpers.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ pub fn get_abs_path(path: &Path) -> PathBuf {
119119
}
120120

121121
pub fn get_basename(path: &Path) -> String {
122-
path
123-
.file_stem()
122+
path.file_stem()
124123
.expect("Could not get basename")
125124
.to_str()
126125
.expect("Could not get basename 2")
@@ -335,8 +334,7 @@ pub fn is_non_exotic_module_name(module_name: &str) -> bool {
335334
}
336335

337336
pub fn get_extension(path: &Path) -> String {
338-
path
339-
.extension()
337+
path.extension()
340338
.expect("Could not get extension")
341339
.to_str()
342340
.expect("Could not get extension 2")

rewatch/src/lock.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ pub enum Error {
2121
impl std::fmt::Display for Error {
2222
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2323
let msg = match self {
24-
Error::Locked(pid) => format!(
25-
"A ReScript build is already running. The process ID (PID) is {pid}"
26-
),
24+
Error::Locked(pid) => {
25+
format!("A ReScript build is already running. The process ID (PID) is {pid}")
26+
}
2727
Error::ParsingLockfile(e) => format!(
2828
"Could not parse lockfile: \n {e} \n (try removing it and running the command again)"
2929
),
30-
Error::ReadingLockfile(e) => format!(
31-
"Could not read lockfile: \n {e} \n (try removing it and running the command again)"
32-
),
30+
Error::ReadingLockfile(e) => {
31+
format!("Could not read lockfile: \n {e} \n (try removing it and running the command again)")
32+
}
3333
Error::WritingLockfile(e) => format!("Could not write lockfile: \n {e}"),
3434
};
3535
write!(f, "{msg}")

0 commit comments

Comments
 (0)