Skip to content

Commit

Permalink
fix: prefix extraction for empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Nov 15, 2024
1 parent 147bb60 commit e40bb34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions parenv-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ pub fn derive_environment(input: TokenStream) -> TokenStream {
_ => None,
})?;

Some(prefix)
Some(if prefix.is_empty() {
prefix
} else {
prefix[1..(prefix.len() - 1)].to_owned()
})
})
.unwrap_or_default();
let prefix = &prefix[1..(prefix.len() - 1)];

let field_descs: Vec<_> = fields
.named
Expand Down

0 comments on commit e40bb34

Please sign in to comment.