summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheidezomp <48419392+heidezomp@users.noreply.github.com>2019-09-27 19:00:21 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-09-28 03:12:38 +0200
commitd1ddfbba23f074bb4df11a1efd5c99e944638744 (patch)
tree608381c1abfe04a20ab90cfa83097e51ef04353c
parent8bf868fd8bd63f0bb064db528e606be64f2a1e3e (diff)
Fallback: call "rustfmt" directly without which
If the `which-rustfmt` feature isn't enabled, assume that the binary is called "rustfmt" and that it is in the user's PATH, instead of returning an error.
-rw-r--r--src/lib.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 57d46be7..f7957d84 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1958,10 +1958,9 @@ impl Bindings {
}
}
#[cfg(not(feature = "which-rustfmt"))]
- Err(io::Error::new(
- io::ErrorKind::Other,
- "which wasn't enabled, and no rustfmt binary specified",
- ))
+ // No rustfmt binary was specified, so assume that the binary is called
+ // "rustfmt" and that it is in the user's PATH.
+ Ok(Cow::Owned("rustfmt".into()))
}
/// Checks if rustfmt_bindings is set and runs rustfmt on the string