1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
12 #![allow(unused_unsafe)]
15 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
17 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
19 // don't lint extern fns
20 extern "C" fn extern_fn(
33 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool);
34 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
42 fn good_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
43 fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
46 // ok, we don’t want to warn implementations
48 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
49 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
51 fn ptr(p: *const u8) {
52 println!("{}", unsafe { *p });
53 println!("{:?}", unsafe { p.as_ref() });
54 unsafe { std::ptr::read(p) };
58 // NOT_UNSAFE_PTR_ARG_DEREF
60 fn private(p: *const u8) {
61 println!("{}", unsafe { *p });
64 pub fn public(p: *const u8) {
65 println!("{}", unsafe { *p });
66 println!("{:?}", unsafe { p.as_ref() });
67 unsafe { std::ptr::read(p) };
71 fn private(self, p: *const u8) {
72 println!("{}", unsafe { *p });
75 pub fn public(self, p: *const u8) {
76 println!("{}", unsafe { *p });
77 println!("{:?}", unsafe { p.as_ref() });
78 unsafe { std::ptr::read(p) };
81 pub fn public_ok(self, p: *const u8) {
87 pub unsafe fn public_unsafe(self, p: *const u8) {
88 println!("{}", unsafe { *p });
89 println!("{:?}", unsafe { p.as_ref() });