Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libbpf-cargo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Unreleased
----------
- Added ability to skip running `rustfmt` on the skeleton Rust source entirely
in `libbpf-cargo` by setting `rustfmt-path` to an empty string for the CLI or
passing an empty path to `SkeletonBuilder::rustfmt()`.
- Added ability to skip running `rustfmt` on generated skeleton by
passing empty string to `--rustfmt-path` command line option or
`SkeletonBuilder::rustfmt()`


0.27.2
Expand Down
5 changes: 2 additions & 3 deletions libbpf-cargo/src/gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ pub(crate) enum OutputDest<'a> {

/// Try running `rustfmt` over `s` and return result.
///
/// If no `rustfmt` binary could be found, or an empty path is supplied,
/// the content is left untouched, as it's only meant as a cosmetic brush up,
/// without change of semantics.
/// If no `rustfmt` binary could be found or an empty path is supplied,
/// the content is left untouched.
fn try_rustfmt<'code>(s: &'code str, rustfmt_path: Option<&Path>) -> Result<Cow<'code, [u8]>> {
let result = if let Some(r) = rustfmt_path {
if r.as_os_str().is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions libbpf-cargo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ impl SkeletonBuilder {

/// Specify which `rustfmt` binary to use.
///
/// Default searches `$PATH` for `rustfmt`.
/// To skip formatting, an empty path can be supplied.
/// Default searches `$PATH` for `rustfmt`. To skip formatting, an
/// empty path can be supplied.
pub fn rustfmt<P: AsRef<Path>>(&mut self, rustfmt: P) -> &mut Self {
self.rustfmt = rustfmt.as_ref().to_path_buf();
self
Expand Down
1 change: 1 addition & 0 deletions libbpf-cargo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ enum Command {
manifest_path: Option<PathBuf>,
#[arg(long, value_parser)]
/// Path to rustfmt binary.
///
/// If set to an empty path, formatting will be skipped.
rustfmt_path: Option<PathBuf>,
#[arg(long, value_parser)]
Expand Down
Loading