mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 23:55:54 +00:00
revset: flatten match arms of description|author|committer predicates
Since most of the code duplicates has been extracted to helper functions, nested match statement looks more verbose.
This commit is contained in:
parent
18feef3775
commit
19a3fb7d6c
1 changed files with 12 additions and 10 deletions
|
@ -735,18 +735,20 @@ fn parse_function_expression(
|
|||
expect_no_arguments(name, arguments_pair)?;
|
||||
Ok(RevsetExpression::all().with_parent_count(2..u32::MAX))
|
||||
}
|
||||
"description" | "author" | "committer" => {
|
||||
"description" => {
|
||||
let arg = expect_one_argument(name, arguments_pair)?;
|
||||
let needle = parse_function_argument_to_string(name, arg)?;
|
||||
let candidates = RevsetExpression::all();
|
||||
match name {
|
||||
"description" => Ok(candidates.with_description(needle)),
|
||||
"author" => Ok(candidates.with_author(needle)),
|
||||
"committer" => Ok(candidates.with_committer(needle)),
|
||||
_ => {
|
||||
panic!("unexpected function name: {}", name)
|
||||
}
|
||||
}
|
||||
Ok(RevsetExpression::all().with_description(needle))
|
||||
}
|
||||
"author" => {
|
||||
let arg = expect_one_argument(name, arguments_pair)?;
|
||||
let needle = parse_function_argument_to_string(name, arg)?;
|
||||
Ok(RevsetExpression::all().with_author(needle))
|
||||
}
|
||||
"committer" => {
|
||||
let arg = expect_one_argument(name, arguments_pair)?;
|
||||
let needle = parse_function_argument_to_string(name, arg)?;
|
||||
Ok(RevsetExpression::all().with_committer(needle))
|
||||
}
|
||||
"file" => {
|
||||
if let Some(ctx) = workspace_ctx {
|
||||
|
|
Loading…
Reference in a new issue