Skip to content

Commit

Permalink
fix lints in 1.71 and latest beta (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadamcrain authored Jul 17, 2023
1 parent f681144 commit 1cd71d1
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oo-bindgen/src/backend/java/jni/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub(crate) fn generate_interfaces_cache(
interface.name, destroy_func_name
))?;
blocked(f, |f| {
f.writeln("unsafe { Box::from_raw(ctx as *mut jni::objects::GlobalRef) };")
f.writeln("unsafe { let _ = Box::from_raw(ctx as *mut jni::objects::GlobalRef); };")
})?;
}

Expand Down
2 changes: 1 addition & 1 deletion oo-bindgen/src/backend/java/jni/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ fn write_function(
.call_site(&param.name)
.unwrap_or_else(|| param.name.to_string())
})
.chain(extra_param.into_iter())
.chain(extra_param)
.collect::<Vec<String>>()
.join(", ");

Expand Down
2 changes: 1 addition & 1 deletion oo-bindgen/src/backend/java/jni/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ where
}
}
} else {
f.writeln("_phantom: std::marker::PhantomData::default(),")?;
f.writeln("_phantom: std::marker::PhantomData,")?;
}
Ok(())
})?;
Expand Down
1 change: 0 additions & 1 deletion oo-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ clippy::all
#![forbid(
unsafe_code,
//intra_doc_link_resolution_failure, broken_intra_doc_links
unaligned_references,
while_true,
bare_trait_objects
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/foo-ffi/src/primitive_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl RangeIterator {
}

pub(crate) fn range_iterator_next(it: *mut RangeIterator) -> *const u32 {
let mut it = unsafe { it.as_mut().unwrap() };
let it = unsafe { it.as_mut().unwrap() };
if it.next > it.max {
return std::ptr::null();
}
Expand Down
8 changes: 4 additions & 4 deletions tests/foo-ffi/src/primitive_pointers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) unsafe fn primitive_pointers_get_bool(
instance: *mut crate::PrimitivePointers,
value: bool,
) -> *const bool {
let mut instance = instance.as_mut().unwrap();
let instance = instance.as_mut().unwrap();
instance.bool_value = value;
&instance.bool_value
}
Expand All @@ -37,7 +37,7 @@ pub(crate) unsafe fn primitive_pointers_get_u8(
instance: *mut crate::PrimitivePointers,
value: u8,
) -> *const u8 {
let mut instance = instance.as_mut().unwrap();
let instance = instance.as_mut().unwrap();
instance.u8_value = value;
&instance.u8_value
}
Expand All @@ -46,7 +46,7 @@ pub(crate) unsafe fn primitive_pointers_get_float(
instance: *mut crate::PrimitivePointers,
value: f32,
) -> *const f32 {
let mut instance = instance.as_mut().unwrap();
let instance = instance.as_mut().unwrap();
instance.float_value = value;
&instance.float_value
}
Expand All @@ -55,7 +55,7 @@ pub(crate) unsafe fn primitive_pointers_get_double(
instance: *mut crate::PrimitivePointers,
value: f64,
) -> *const f64 {
let mut instance = instance.as_mut().unwrap();
let instance = instance.as_mut().unwrap();
instance.double_value = value;
&instance.double_value
}
2 changes: 1 addition & 1 deletion tests/foo-ffi/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub unsafe fn string_class_destroy(string_class: *mut StringClass) {
}

pub unsafe fn string_class_echo(string_class: *mut StringClass, value: &CStr) -> &CStr {
let mut string_class = string_class.as_mut().unwrap();
let string_class = string_class.as_mut().unwrap();
string_class.value = value.to_owned();
&string_class.value
}
Expand Down

0 comments on commit 1cd71d1

Please sign in to comment.