-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New function alias: env() #1613
Conversation
Thanks for the PR! It looks like the
Which accepts only one or two arguments? |
Good call @casey! I have updated to introduce UnaryOpt 👌 |
@@ -2334,6 +2334,34 @@ mod tests { | |||
}, | |||
} | |||
|
|||
error! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests break the function_argument_<variant>
convention by adding a too-many and a too-few test, unsure if this is what you want or should just have the single test.
src/thunk.rs
Outdated
let a = Box::new(arguments.remove(0)); | ||
let opt_b = match arguments.pop() { | ||
Some(value) => Box::new(Some(value)), | ||
None => Box::new(None), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove(0)
to grab from the front of the list, then a pop
on the last element, happy to hear a prettier way 😅
Nice, merged! |
In relation to #1278, this PR adds a new
env
function which acts as an alias to bothenv_var
andenv_var_or_default
:To make such a function signature possible, a new
UnaryOpt
enum variant was added which accounts for the majority of the touched files!