Skip to content

Commit 81da0cd

Browse files
committed
Add test case for lazy_static::lazy_static! before style edition 2027
1 parent e56a61f commit 81da0cd

File tree

2 files changed

+80
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)