]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/lazy_static.rs
Rollup merge of #107166 - petrochenkov:nooptable, r=oli-obk
[rust.git] / src / tools / rustfmt / tests / source / lazy_static.rs
1 // Format `lazy_static!`.
2
3 lazy_static! {
4 static ref CONFIG_NAME_REGEX: regex::Regex =
5 regex::Regex::new(r"^## `([^`]+)`").expect("Failed creating configuration pattern");
6 static ref CONFIG_VALUE_REGEX: regex::Regex = regex::Regex::new(r#"^#### `"?([^`"]+)"?`"#)
7 .expect("Failed creating configuration value pattern");
8 }
9
10 // We need to be able to format `lazy_static!` without known syntax.
11 lazy_static!(
12     xxx,
13 yyyy ,
14     zzzzz
15 );
16
17 lazy_static!{
18 }
19
20 // #2354
21 lazy_static ! {
22 pub static ref Sbase64_encode_string : :: lisp :: LispSubrRef = {
23 let subr = :: remacs_sys :: Lisp_Subr {
24 header : :: remacs_sys :: Lisp_Vectorlike_Header {
25 size : (
26 ( :: remacs_sys :: PseudovecType :: PVEC_SUBR as :: libc :: ptrdiff_t ) << ::
27 remacs_sys :: PSEUDOVECTOR_AREA_BITS ) , } , function : self ::
28 Fbase64_encode_string as * const :: libc :: c_void , min_args : 1i16 ,
29 max_args : 2i16 , symbol_name : ( b"base64-encode-string\x00" ) . as_ptr (  )
30 as * const :: libc :: c_char , intspec : :: std :: ptr :: null (  ) , doc : ::
31 std :: ptr :: null (  ) , lang : :: remacs_sys :: Lisp_Subr_Lang_Rust , } ;
32 unsafe {
33 let ptr = :: remacs_sys :: xmalloc (
34 :: std :: mem :: size_of :: < :: remacs_sys :: Lisp_Subr > (  ) ) as * mut ::
35 remacs_sys :: Lisp_Subr ; :: std :: ptr :: copy_nonoverlapping (
36 & subr , ptr , 1 ) ; :: std :: mem :: forget ( subr ) ; :: lisp :: ExternalPtr
37 :: new ( ptr ) } } ; }
38
39
40 lazy_static! {
41 static ref FOO: HashMap<String,
42 (&'static str,
43 fn(Foo) -> Result<Box<Bar>, Either<FooError, BarError>>
44 ),> = HashMap::new();
45 }