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.
11 #![feature(tool_lints)]
16 #![allow(unused_unsafe)]
19 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
21 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
24 // don't lint extern fns
25 extern fn extern_fn(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
28 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool);
29 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
37 fn good_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
38 fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
41 // ok, we don’t want to warn implementations
43 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
44 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
46 fn ptr(p: *const u8) {
47 println!("{}", unsafe { *p });
48 println!("{:?}", unsafe { p.as_ref() });
49 unsafe { std::ptr::read(p) };
53 // NOT_UNSAFE_PTR_ARG_DEREF
55 fn private(p: *const u8) {
56 println!("{}", unsafe { *p });
59 pub fn public(p: *const u8) {
60 println!("{}", unsafe { *p });
61 println!("{:?}", unsafe { p.as_ref() });
62 unsafe { std::ptr::read(p) };
66 fn private(self, p: *const u8) {
67 println!("{}", unsafe { *p });
70 pub fn public(self, p: *const u8) {
71 println!("{}", unsafe { *p });
72 println!("{:?}", unsafe { p.as_ref() });
73 unsafe { std::ptr::read(p) };
76 pub fn public_ok(self, p: *const u8) {
82 pub unsafe fn public_unsafe(self, p: *const u8) {
83 println!("{}", unsafe { *p });
84 println!("{:?}", unsafe { p.as_ref() });