]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui-toml/absolute_paths/absolute_paths.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui-toml / absolute_paths / absolute_paths.rs
CommitLineData
781aab86 1//@aux-build:../../ui/auxiliary/proc_macros.rs
add651ee
FG
2//@aux-build:helper.rs
3//@revisions: allow_crates disallow_crates
4//@[allow_crates] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/absolute_paths/allow_crates
5//@[disallow_crates] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/absolute_paths/disallow_crates
6#![allow(clippy::no_effect, unused)]
7#![warn(clippy::absolute_paths)]
8#![feature(decl_macro)]
9
10extern crate helper;
11#[macro_use]
12extern crate proc_macros;
13
14pub mod a {
15 pub mod b {
16 pub mod c {
17 pub struct C;
18
19 impl C {
20 pub const ZERO: u32 = 0;
21 }
22
23 pub mod d {
24 pub mod e {
25 pub mod f {
26 pub struct F;
27 }
28 }
29 }
30 }
31
32 pub struct B;
33 }
34
35 pub struct A;
36}
37
38fn main() {
39 f32::max(1.0, 2.0);
40 std::f32::MAX;
41 core::f32::MAX;
42 ::core::f32::MAX;
43 crate::a::b::c::C;
44 crate::a::b::c::d::e::f::F;
45 crate::a::A;
46 crate::a::b::B;
47 crate::a::b::c::C::ZERO;
48 helper::b::c::d::e::f();
49 ::helper::b::c::d::e::f();
50 fn b() -> a::b::B {
51 todo!()
52 }
53 std::println!("a");
54 let x = 1;
55 std::ptr::addr_of!(x);
56 // Test we handle max segments with `PathRoot` properly; this has 4 segments but we should say it
57 // has 3
58 ::std::f32::MAX;
59 // Do not lint due to the above
60 ::helper::a();
61 // Do not lint
62 helper::a();
63 use crate::a::b::c::C;
64 use a::b;
65 use std::f32::MAX;
66 a::b::c::d::e::f::F;
67 b::c::C;
68 fn a() -> a::A {
69 todo!()
70 }
71 use a::b::c;
72
73 fn c() -> c::C {
74 todo!()
75 }
76 fn d() -> Result<(), ()> {
77 todo!()
78 }
79 external! {
80 crate::a::b::c::C::ZERO;
81 }
82 // For some reason, `path.span.from_expansion()` takes care of this for us
83 with_span! {
84 span
85 crate::a::b::c::C::ZERO;
86 }
87 macro_rules! local_crate {
88 () => {
89 crate::a::b::c::C::ZERO;
90 };
91 }
92 macro local_crate_2_0() {
93 crate::a::b::c::C::ZERO;
94 }
95 local_crate!();
96 local_crate_2_0!();
97}