Skip to content

Commit 910e981

Browse files
committed
gen-rust: fix final clippy warnings
1 parent 27a6e72 commit 910e981

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

generators/rust-oo-bindgen/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ impl<'a> RustCodegen<'a> {
156156
};
157157

158158
// Accessor
159+
f.writeln("#[allow(clippy::needless_lifetimes)]")?;
159160
f.writeln(&format!(
160161
"pub fn {name}{fn_lifetime}(&{lifetime}self) -> {ampersand}{return_type}",
161162
name = element.name,
@@ -191,7 +192,10 @@ impl<'a> RustCodegen<'a> {
191192
}
192193
})?;
193194

195+
f.newline()?;
196+
194197
// Mutator
198+
f.writeln("#[allow(clippy::needless_lifetimes)]")?;
195199
f.writeln(&format!(
196200
"pub fn set_{name}{fn_lifetime}(&{lifetime}mut self, value: {element_type})",
197201
name = element.name,
@@ -334,6 +338,7 @@ impl<'a> RustCodegen<'a> {
334338
f: &mut dyn Printer,
335339
handle: &NativeFunctionHandle,
336340
) -> FormattingResult<()> {
341+
f.writeln("#[allow(clippy::missing_safety_doc)]")?;
337342
f.writeln("#[no_mangle]")?;
338343
f.writeln(&format!("pub unsafe extern \"C\" fn {}(", handle.name))?;
339344

tests/foo-ffi/src/collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub unsafe fn collection_destroy(col: *mut StringCollection) {
3636
}
3737
}
3838

39-
pub unsafe fn collection_add<'a>(col: *mut StringCollection, value: &'a CStr) {
39+
pub unsafe fn collection_add(col: *mut StringCollection, value: &CStr) {
4040
if let Some(col) = col.as_mut() {
4141
let value = value.to_owned();
4242
col.add(value);

tests/foo-ffi/src/ffi.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
#![allow(clippy::missing_safety_doc)]
2-
31
include!(concat!(env!("OUT_DIR"), "/ffi.rs"));

tests/foo-ffi/src/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl StringIterator {
2222
}
2323
}
2424

25-
pub unsafe fn iterator_create<'a>(value: &'a CStr) -> *mut StringIterator {
25+
pub unsafe fn iterator_create(value: &CStr) -> *mut StringIterator {
2626
let bytes = value.to_bytes().to_vec();
2727
let it = Box::new(StringIterator::new(bytes));
2828
Box::into_raw(it)

tests/foo-ffi/src/strings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ pub unsafe fn string_destroy(string_class: *mut StringClass) {
2323
}
2424
}
2525

26-
pub unsafe fn string_echo<'a>(string_class: *mut StringClass, value: &'a CStr) -> &'a CStr {
26+
pub unsafe fn string_echo(string_class: *mut StringClass, value: &CStr) -> &CStr {
2727
let mut string_class = string_class.as_mut().unwrap();
2828
string_class.value = value.to_owned();
2929
&string_class.value
3030
}
3131

32-
pub unsafe fn string_length<'a>(value: &'a CStr) -> u32 {
32+
pub unsafe fn string_length(value: &CStr) -> u32 {
3333
value.to_string_lossy().len() as u32
3434
}

0 commit comments

Comments
 (0)