diff --git a/Cargo.toml b/Cargo.toml index 248c041378..9fcb68632c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,14 +63,12 @@ explicit_into_iter_loop = "allow" flat_map_option = "allow" ignored_unit_patterns = "allow" implicit_hasher = "allow" -inconsistent_struct_constructor = "allow" items_after_statements = "allow" maybe_infinite_iter = "allow" missing_errors_doc = "allow" missing_panics_doc = "allow" module_name_repetitions = "allow" must_use_candidate = "allow" -ptr_as_ptr = "allow" redundant_closure_for_method_calls = "allow" return_self_not_must_use = "allow" #should_panic_without_expect = "allow" diff --git a/bindgen/clang.rs b/bindgen/clang.rs index 66558bc8cc..2440bc0ae6 100644 --- a/bindgen/clang.rs +++ b/bindgen/clang.rs @@ -1045,9 +1045,7 @@ pub(crate) struct ClangToken { impl ClangToken { /// Get the token spelling, without being converted to utf-8. pub(crate) fn spelling(&self) -> &[u8] { - let c_str = unsafe { - CStr::from_ptr(clang_getCString(self.spelling) as *const _) - }; + let c_str = unsafe { CStr::from_ptr(clang_getCString(self.spelling)) }; c_str.to_bytes() } @@ -1098,9 +1096,9 @@ impl Iterator for ClangTokenIterator<'_> { let spelling = clang_getTokenSpelling(self.tu, *raw); let extent = clang_getTokenExtent(self.tu, *raw); Some(ClangToken { - kind, - extent, spelling, + extent, + kind, }) } } @@ -1124,7 +1122,7 @@ extern "C" fn visit_children( where Visitor: FnMut(Cursor) -> CXChildVisitResult, { - let func: &mut Visitor = unsafe { &mut *(data as *mut Visitor) }; + let func: &mut Visitor = unsafe { &mut *data.cast::() }; let child = Cursor { x: cur }; (*func)(child) @@ -1763,7 +1761,7 @@ fn cxstring_to_string_leaky(s: CXString) -> String { if s.data.is_null() { return String::new(); } - let c_str = unsafe { CStr::from_ptr(clang_getCString(s) as *const _) }; + let c_str = unsafe { CStr::from_ptr(clang_getCString(s)) }; c_str.to_string_lossy().into_owned() }