~repos /rust-embed

#rust#proc-macro#http

git clone https://pyrossh.dev/repos/rust-embed.git

rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.


7ced6cd2 Hamir Mahal

11 months ago
refactor: replace `map().unwrap_or_else()`
Files changed (1) hide show
  1. impl/src/lib.rs +1 -2
impl/src/lib.rs CHANGED
@@ -324,8 +324,7 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> syn::Result<TokenStream2> {
324
324
 
325
325
  let crate_path: syn::Path = find_attribute_values(ast, "crate_path")
326
326
  .last()
327
- .map(|v| syn::parse_str(v).unwrap())
328
- .unwrap_or_else(|| syn::parse_str("rust_embed").unwrap());
327
+ .map_or_else(|| syn::parse_str("rust_embed").unwrap(), |v| syn::parse_str(v).unwrap());
329
328
 
330
329
  let mut folder_paths = find_attribute_values(ast, "folder");
331
330
  if folder_paths.len() != 1 {