Skip to content

Commit

Permalink
chore: remove collect from fuse
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Feb 1, 2024
1 parent 3d80c9e commit 7aca7b9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/blueprint/operators/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fn compile(ctx: &CompilationContext, expr: ExprBody) -> Valid<Expression, String
.map(Box::new)
.fuse(compile(ctx, *then.clone()).map(Box::new))
.fuse(compile(ctx, *els.clone()).map(Box::new))
.collect()
.map(|(cond, then, els)| {
Expression::Logic(Logic::If { cond, then, els }).parallel_when(expr.has_io())
})
Expand Down
1 change: 0 additions & 1 deletion src/blueprint/operators/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ pub fn compile_grpc(inputs: CompileGrpc) -> Valid<Expression, String> {
))
.fuse(helpers::headers::to_mustache_headers(&grpc.headers))
.fuse(helpers::body::to_body(grpc.body.as_deref()))
.collect()
.and_then(|(url, operation, headers, body)| {
let validation = if validate_with_schema {
let field_schema = json_schema_from_field(config_set, field);
Expand Down
1 change: 0 additions & 1 deletion src/blueprint/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl TryFrom<crate::config::Server> for Server {
(config_server).get_response_headers().0,
))
.fuse(to_script(&config_server))
.collect()
.map(|(hostname, http, response_headers, script)| Server {
enable_apollo_tracing: (config_server).enable_apollo_tracing(),
enable_cache_control_header: (config_server).enable_cache_control(),
Expand Down
31 changes: 14 additions & 17 deletions src/config/from_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,20 @@ pub fn from_document(doc: ServiceDocument) -> Valid<Config, String> {
let types = to_types(&type_definitions);
let unions = to_union_types(&type_definitions);
let schema = schema_definition(&doc).map(to_root_schema);
schema_definition(&doc)
.and_then(|sd| {
server(sd)
.fuse(upstream(sd))
.fuse(types)
.fuse(unions)
.fuse(schema)
.collect()
})
.map(|(server, upstream, types, unions, schema)| Config {
server,
upstream,
types,
unions,
schema,
})
schema_definition(&doc).and_then(|sd| {
server(sd)
.fuse(upstream(sd))
.fuse(types)
.fuse(unions)
.fuse(schema)
.map(|(server, upstream, types, unions, schema)| Config {
server,
upstream,
types,
unions,
schema,
})
})
}

fn schema_definition(doc: &ServiceDocument) -> Valid<&SchemaDefinition, String> {
Expand Down Expand Up @@ -255,7 +253,6 @@ where
.fuse(Omit::from_directives(directives.iter()))
.fuse(Modify::from_directives(directives.iter()))
.fuse(JS::from_directives(directives.iter()))
.collect()
.map(|(http, graphql, cache, grpc, expr, omit, modify, script)| {
let const_field = to_const_field(directives);
config::Field {
Expand Down
4 changes: 0 additions & 4 deletions src/valid/valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ pub trait Validator<A, E>: Sized {
Valid(self.to_result().map(f))
}

fn collect(self) -> Valid<A, E> {
Valid(self.to_result())
}

fn foreach(self, mut f: impl FnMut(A)) -> Valid<A, E>
where
A: Clone,
Expand Down

0 comments on commit 7aca7b9

Please sign in to comment.