rust-embed v8.11.0

#rust#proc-macro#http

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

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


207381dTommy Yu 2026-05-24T17:27:29+12:00
Remove redundant `Option`/`.unwrap()` and comment
Files changed (1) hide show
  1. impl/src/lib.rs +2 -3
impl/src/lib.rs CHANGED
@@ -368,7 +368,7 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> syn::Result<TokenStream2> {
368
368
  "#[derive(RustEmbed)] must contain one attribute like this #[folder = \"examples/public/\"]",
369
369
  ));
370
370
  }
371
- let folder_path = Some(folder_paths.remove(0));
371
+ let folder_path = folder_paths.remove(0);
372
372
 
373
373
  let prefix = find_attribute_values(ast, "prefix").into_iter().next();
374
374
  let includes = find_attribute_values(ast, "include");
@@ -384,9 +384,8 @@ fn impl_rust_embed(ast: &syn::DeriveInput) -> syn::Result<TokenStream2> {
384
384
  ));
385
385
  }
386
386
 
387
- // .map_err(|v| syn::Error::new_spanned(ast, v.to_string()))?
388
387
  #[cfg(feature = "interpolate-folder-path")]
389
- let folder_path = match shellexpand::full(&folder_path.unwrap()) {
388
+ let folder_path = match shellexpand::full(&folder_path) {
390
389
  Ok(v) => Ok(Some(v.to_string())),
391
390
  Err(v) if v.cause == std::env::VarError::NotPresent && allow_missing => Ok(None),
392
391
  Err(v) => Err(syn::Error::new_spanned(ast, v.to_string())),