|
1 | | -// Format `lazy_static!`. |
| 1 | +// rustfmt-style_edition: 2027 |
| 2 | +// Format `lazy_static!` and `lazy_static::lazy_static!`. |
2 | 3 |
|
3 | 4 | lazy_static! { |
4 | 5 | static ref CONFIG_NAME_REGEX: regex::Regex = |
@@ -43,3 +44,47 @@ static ref FOO: HashMap<String, |
43 | 44 | fn(Foo) -> Result<Box<Bar>, Either<FooError, BarError>> |
44 | 45 | ),> = HashMap::new(); |
45 | 46 | } |
| 47 | + |
| 48 | +lazy_static::lazy_static! { |
| 49 | +static ref CONFIG_NAME_REGEX: regex::Regex = |
| 50 | +regex::Regex::new(r"^## `([^`]+)`").expect("Failed creating configuration pattern"); |
| 51 | +static ref CONFIG_VALUE_REGEX: regex::Regex = regex::Regex::new(r#"^#### `"?([^`"]+)"?`"#) |
| 52 | +.expect("Failed creating configuration value pattern"); |
| 53 | +} |
| 54 | + |
| 55 | +// We need to be able to format `lazy_static::lazy_static!` without known syntax. |
| 56 | +lazy_static::lazy_static!( |
| 57 | + xxx, |
| 58 | +yyyy , |
| 59 | + zzzzz |
| 60 | +); |
| 61 | + |
| 62 | +lazy_static::lazy_static!{ |
| 63 | +} |
| 64 | + |
| 65 | +// #2354 |
| 66 | +lazy_static::lazy_static ! { |
| 67 | +pub static ref Sbase64_encode_string : :: lisp :: LispSubrRef = { |
| 68 | +let subr = :: remacs_sys :: Lisp_Subr { |
| 69 | +header : :: remacs_sys :: Lisp_Vectorlike_Header { |
| 70 | +size : ( |
| 71 | +( :: remacs_sys :: PseudovecType :: PVEC_SUBR as :: libc :: ptrdiff_t ) << :: |
| 72 | +remacs_sys :: PSEUDOVECTOR_AREA_BITS ) , } , function : self :: |
| 73 | +Fbase64_encode_string as * const :: libc :: c_void , min_args : 1i16 , |
| 74 | +max_args : 2i16 , symbol_name : ( b"base64-encode-string\x00" ) . as_ptr ( ) |
| 75 | +as * const :: libc :: c_char , intspec : :: std :: ptr :: null ( ) , doc : :: |
| 76 | +std :: ptr :: null ( ) , lang : :: remacs_sys :: Lisp_Subr_Lang_Rust , } ; |
| 77 | +unsafe { |
| 78 | +let ptr = :: remacs_sys :: xmalloc ( |
| 79 | +:: std :: mem :: size_of :: < :: remacs_sys :: Lisp_Subr > ( ) ) as * mut :: |
| 80 | +remacs_sys :: Lisp_Subr ; :: std :: ptr :: copy_nonoverlapping ( |
| 81 | +& subr , ptr , 1 ) ; :: std :: mem :: forget ( subr ) ; :: lisp :: ExternalPtr |
| 82 | +:: new ( ptr ) } } ; } |
| 83 | + |
| 84 | + |
| 85 | +lazy_static::lazy_static! { |
| 86 | +static ref FOO: HashMap<String, |
| 87 | +(&'static str, |
| 88 | +fn(Foo) -> Result<Box<Bar>, Either<FooError, BarError>> |
| 89 | +),> = HashMap::new(); |
| 90 | +} |
0 commit comments