Skip to content

Commit

Permalink
Rustfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
vakaras committed Jan 11, 2020
1 parent 551371f commit 9993cf5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion examples/generate_skeleton.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::env;
use datapond;
use std::env;

fn main() {
if env::var("RUST_LOG").is_ok() {
Expand Down
32 changes: 14 additions & 18 deletions src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,26 +909,25 @@ fn generate_skeleton_code(
let relation_args = join_args_as_tuple(&declared_args, &key, &args);
format!("({}, _)", relation_args)
} else {
let arg_names: Vec<_> = indexed_literal
.args
.iter()
.map(|v| v.to_string())
.collect();

let arg_names: Vec<_> = indexed_literal.args.iter().map(|v| v.to_string()).collect();

let canonicalized_key: Vec<_> = key
.iter()
.map(|v| canonicalize_arg_name(&decls, &indexed_literal.predicate, &arg_names, v))
.collect();

let canonicalized_args: Vec<_> = args
.iter()
.map(|v| canonicalize_arg_name(&decls, &indexed_literal.predicate, &arg_names, v))
.collect();

produced_key = join_args_as_tuple(&canonicalized_key, &canonicalized_key, &canonicalized_args);
produced_args = join_args_as_tuple(&canonicalized_args, &canonicalized_key, &canonicalized_args);

let relation_args = join_args_as_tuple(&declared_args, &canonicalized_key, &canonicalized_args);
produced_key =
join_args_as_tuple(&canonicalized_key, &canonicalized_key, &canonicalized_args);
produced_args =
join_args_as_tuple(&canonicalized_args, &canonicalized_key, &canonicalized_args);

let relation_args =
join_args_as_tuple(&declared_args, &canonicalized_key, &canonicalized_args);

relation_args
};
Expand Down Expand Up @@ -1073,13 +1072,10 @@ fn find_arg_decl<'a>(
args: &Vec<String>,
variable: &str,
) -> &'a ast::ParamDecl {
let idx = args
.iter()
.position(|arg| arg == variable)
.expect(&format!(
"Couldn't find variable {:?} in the specified args: {:?}",
variable, args
));
let idx = args.iter().position(|arg| arg == variable).expect(&format!(
"Couldn't find variable {:?} in the specified args: {:?}",
variable, args
));

let predicate_arg_decls = &global_decls[&predicate.to_string()];
let arg_decl = &predicate_arg_decls.parameters[idx];
Expand Down
2 changes: 1 addition & 1 deletion src/generator_new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ pub fn generate_datafrog(input: TokenStream) -> TokenStream {
let typechecked_program = crate::typechecker::typecheck(parsed_program).unwrap();
let encoded_program = encode::encode(typechecked_program);
encoded_program.to_token_stream()
}
}
1 change: 0 additions & 1 deletion tests/cspa_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ fn ensure_generated_rules_build() {
memory_alias.extend(assign.iter().map(|&(x, _y)| (x, x)));

while iteration.changed() {

// Index maintenance
value_flow_b.from_map(&value_flow, |&(a, b)| (b, a));
value_flow_a.from_map(&value_flow, |&(a, b)| (a, b)); // useless index
Expand Down

0 comments on commit 9993cf5

Please sign in to comment.