Skip to content

Commit

Permalink
style: Cargo fmt + clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsvante committed Mar 29, 2023
1 parent 53a4fe5 commit 58f4f87
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion benches/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cornucopia::{conn::cornucopia_conn, CodegenSettings, container::ContainerOpts};
use cornucopia::{conn::cornucopia_conn, container::ContainerOpts, CodegenSettings};
use criterion::Criterion;

fn bench(c: &mut Criterion) {
Expand Down
12 changes: 10 additions & 2 deletions crates/cornucopia/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ use std::path::PathBuf;

use clap::{Parser, Subcommand};

use crate::{conn, container::{self, ContainerOpts}, error::Error, generate_live, generate_managed, CodegenSettings};
use crate::{
conn,
container::{self, ContainerOpts},
error::Error,
generate_live, generate_managed, CodegenSettings,
};

/// Command line interface to interact with Cornucopia SQL.
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -66,7 +71,10 @@ pub fn run() -> Result<(), Error> {
let mut client = conn::from_url(&url)?;
generate_live(&mut client, &queries_path, Some(&destination), settings)?;
}
Action::Schema { schema_files, container_opts } => {
Action::Schema {
schema_files,
container_opts,
} => {
// Run the generate command. If the command is unsuccessful, cleanup Cornucopia's container
if let Err(e) = generate_managed(
queries_path,
Expand Down
4 changes: 2 additions & 2 deletions crates/cornucopia/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn gen_params_struct(w: &mut impl Write, params: &PreparedItem, ctx: &GenCtx) {
.map(|p| p.param_ergo_ty(traits, ctx))
.collect::<Vec<_>>();
let fields_name = fields.iter().map(|p| &p.ident.rs);
let traits_idx = (1..=traits.len()).into_iter().map(idx_char);
let traits_idx = (1..=traits.len()).map(idx_char);
code!(w =>
#[derive($copy Debug)]
pub struct $name<$lifetime $($traits_idx: $traits,)> {
Expand Down Expand Up @@ -507,7 +507,7 @@ fn gen_query_fn<W: Write>(w: &mut W, module: &PreparedModule, query: &PreparedQu
.map(|idx| param_field[*idx].param_ergo_ty(traits, ctx))
.collect();
let params_name = order.iter().map(|idx| &param_field[*idx].ident.rs);
let traits_idx = (1..=traits.len()).into_iter().map(idx_char);
let traits_idx = (1..=traits.len()).map(idx_char);
let lazy_impl = |w: &mut W| {
if let Some((idx, index)) = row {
let item = module.rows.get_index(*idx).unwrap().1;
Expand Down
2 changes: 1 addition & 1 deletion crates/cornucopia/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub(crate) mod error {
};
Error {
msg,
help: Some(String::from(help)),
help: Some(help),
}
}
}
Expand Down

0 comments on commit 58f4f87

Please sign in to comment.