Skip to content

Commit ef8aa88

Browse files
committed
fix: address Clippy change
1 parent 6e13d4f commit ef8aa88

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

bindgen-tests/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ pub fn main() {
3333
.replace(|c| !char::is_alphanumeric(c), "_")
3434
.replace("__", "_")
3535
.to_lowercase();
36-
writeln!(dst, "test_header!(header_{func}, {:?});", entry.path())
37-
.unwrap();
36+
writeln!(
37+
dst,
38+
"test_header!(header_{func}, {});",
39+
entry.path().display()
40+
)
41+
.unwrap();
3842
}
3943
}
4044

bindgen/ir/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
724724
self.need_bitfield_allocation.push(id);
725725
}
726726

727-
let old_item = mem::replace(&mut self.items[id.0], Some(item));
727+
let old_item = self.items[id.0].replace(item);
728728
assert!(
729729
old_item.is_none(),
730730
"should not have already associated an item with the given id"
@@ -827,7 +827,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
827827
self.add_item_to_module(&item);
828828

829829
let id = item.id();
830-
let old_item = mem::replace(&mut self.items[id.0], Some(item));
830+
let old_item = self.items[id.0].replace(item);
831831
assert!(
832832
old_item.is_none(),
833833
"should not have already associated an item with the given id"
@@ -987,7 +987,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
987987

988988
let result = f(self, &mut item);
989989

990-
let existing = mem::replace(&mut self.items[id.0], Some(item));
990+
let existing = self.items[id.0].replace(item);
991991
assert!(existing.is_none());
992992

993993
result
@@ -1434,7 +1434,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
14341434
debug_assert!(item.kind().is_type());
14351435
self.add_item_to_module(&item);
14361436
let id = item.id();
1437-
let old_item = mem::replace(&mut self.items[id.0], Some(item));
1437+
let old_item = self.items[id.0].replace(item);
14381438
assert!(old_item.is_none(), "Inserted type twice?");
14391439
}
14401440

bindgen/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ impl Bindings {
980980
}
981981

982982
/// Gets the rustfmt path to rustfmt the generated bindings.
983-
fn rustfmt_path(&self) -> io::Result<Cow<'_, PathBuf>> {
983+
fn rustfmt_path(&self) -> io::Result<Cow<'_, Path>> {
984984
debug_assert!(matches!(self.options.formatter, Formatter::Rustfmt));
985985
if let Some(ref p) = self.options.rustfmt_path {
986986
return Ok(Cow::Borrowed(p));

0 commit comments

Comments
 (0)