Skip to content

Commit 6b6af6b

Browse files
nyurikemilio
authored andcommitted
chore: minor cleanup
* fix error messages missing spaces * simplify rustfmt_path()
1 parent b03b222 commit 6b6af6b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

bindgen/ir/comp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl Bitfield {
361361
"`Bitfield::getter_name` called on anonymous field"
362362
);
363363
self.getter_name.as_ref().expect(
364-
"`Bitfield::getter_name` should only be called after\
364+
"`Bitfield::getter_name` should only be called after \
365365
assigning bitfield accessor names",
366366
)
367367
}
@@ -376,7 +376,7 @@ impl Bitfield {
376376
"`Bitfield::setter_name` called on anonymous field"
377377
);
378378
self.setter_name.as_ref().expect(
379-
"`Bitfield::setter_name` should only be called\
379+
"`Bitfield::setter_name` should only be called \
380380
after assigning bitfield accessor names",
381381
)
382382
}

bindgen/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -978,17 +978,17 @@ impl Bindings {
978978
}
979979

980980
/// Gets the rustfmt path to rustfmt the generated bindings.
981-
fn rustfmt_path(&self) -> io::Result<Cow<'_, Path>> {
981+
fn rustfmt_path(&self) -> Cow<'_, Path> {
982982
debug_assert!(matches!(self.options.formatter, Formatter::Rustfmt));
983983
if let Some(ref p) = self.options.rustfmt_path {
984-
return Ok(Cow::Borrowed(p));
985-
}
986-
if let Ok(rustfmt) = env::var("RUSTFMT") {
987-
return Ok(Cow::Owned(rustfmt.into()));
984+
Cow::Borrowed(p)
985+
} else if let Ok(rustfmt) = env::var("RUSTFMT") {
986+
Cow::Owned(rustfmt.into())
987+
} else {
988+
// No rustfmt binary was specified, so assume that the binary is called
989+
// "rustfmt" and that it is in the user's PATH.
990+
Cow::Borrowed(Path::new("rustfmt"))
988991
}
989-
// No rustfmt binary was specified, so assume that the binary is called
990-
// "rustfmt" and that it is in the user's PATH.
991-
Ok(Cow::Owned("rustfmt".into()))
992992
}
993993

994994
/// Formats a token stream with the formatter set up in `BindgenOptions`.
@@ -1008,7 +1008,7 @@ impl Bindings {
10081008
Formatter::Rustfmt => (),
10091009
}
10101010

1011-
let rustfmt = self.rustfmt_path()?;
1011+
let rustfmt = self.rustfmt_path();
10121012
let mut cmd = Command::new(&*rustfmt);
10131013

10141014
cmd.stdin(Stdio::piped()).stdout(Stdio::piped());

0 commit comments

Comments
 (0)