File: anon-fn-params.rs

package info (click to toggle)
rustc 1.90.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 925,928 kB
  • sloc: xml: 158,148; javascript: 19,781; sh: 19,174; python: 15,732; ansic: 13,096; cpp: 7,181; asm: 4,376; makefile: 697; lisp: 176; sql: 15
file content (25 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Test that we render the deprecated anonymous trait function parameters from Rust 2015 as
// underscores in order not to perpetuate it and for legibility.

//@ edition: 2015
#![expect(anonymous_parameters)]

// Check the "local case" (HIR cleaning) //

//@ has anon_fn_params/trait.Trait.html
pub trait Trait {
    //@ has - '//*[@id="tymethod.required"]' 'fn required(_: Option<i32>, _: impl Fn(&str) -> bool)'
    fn required(Option<i32>, impl Fn(&str) -> bool);
    //@ has - '//*[@id="method.provided"]' 'fn provided(_: [i32; 2])'
    fn provided([i32; 2]) {}
}

// Check the "extern case" (middle cleaning) //

//@ aux-build: ext-anon-fn-params.rs
extern crate ext_anon_fn_params;

//@ has anon_fn_params/trait.ExtTrait.html
//@ has - '//*[@id="tymethod.required"]' 'fn required(_: Option<i32>, _: impl Fn(&str) -> bool)'
//@ has - '//*[@id="method.provided"]' 'fn provided(_: [i32; 2])'
pub use ext_anon_fn_params::Trait as ExtTrait;