]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/functions.rs
3 #![allow(unused_unsafe, clippy::missing_safety_doc)]
6 fn good(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
) {}
8 fn bad(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
, _eight
: ()) {}
30 // don't lint extern fns
31 extern "C" fn extern_fn(
39 _eight
: *const std
::ffi
::c_void
,
44 fn good(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
);
45 fn bad(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
, _eight
: ());
53 fn good_method(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
) {}
54 fn bad_method(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
, _eight
: ()) {}
57 // ok, we don’t want to warn implementations
59 fn good(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
) {}
60 fn bad(_one
: u32, _two
: u32, _three
: &str, _four
: bool
, _five
: f32, _six
: f32, _seven
: bool
, _eight
: ()) {}
62 fn ptr(p
: *const u8) {
63 println
!("{}", unsafe { *p }
);
64 println
!("{:?}", unsafe { p.as_ref() }
);
65 unsafe { std::ptr::read(p) }
;
69 // NOT_UNSAFE_PTR_ARG_DEREF
71 fn private(p
: *const u8) {
72 println
!("{}", unsafe { *p }
);
75 pub fn public(p
: *const u8) {
76 println
!("{}", unsafe { *p }
);
77 println
!("{:?}", unsafe { p.as_ref() }
);
78 unsafe { std::ptr::read(p) }
;
82 fn private(self, p
: *const u8) {
83 println
!("{}", unsafe { *p }
);
86 pub fn public(self, p
: *const u8) {
87 println
!("{}", unsafe { *p }
);
88 println
!("{:?}", unsafe { p.as_ref() }
);
89 unsafe { std::ptr::read(p) }
;
92 pub fn public_ok(self, p
: *const u8) {
98 pub unsafe fn public_unsafe(self, p
: *const u8) {
99 println
!("{}", unsafe { *p }
);
100 println
!("{:?}", unsafe { p.as_ref() }
);