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