Skip to content

Commit

Permalink
Clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Virgiel committed Oct 17, 2023
1 parent a2d692c commit cf32042
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/client_core/src/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}

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
3 changes: 2 additions & 1 deletion crates/cornucopia/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ impl Query {
.iter()
.enumerate()
.rev()
.filter_map(|(i, u)| (!bind_params[..i].contains(u)).then(|| u.clone()))
.filter(|(i, u)| !bind_params[..*i].contains(u))
.map(|(_, u)| u.clone())
.rev()
.collect();

Expand Down
5 changes: 2 additions & 3 deletions test_codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ pub fn test_trait_sql(client: &mut Client) {
.unwrap();
find_books().bind(client, &vec![cow]).all().unwrap();

let map: HashMap<&str, &str> =
HashMap::from_iter([("one", "1"), ("two", "2"), ("three", "3")].into_iter());
let map: HashMap<&str, &str> = HashMap::from_iter([("one", "1"), ("two", "2"), ("three", "3")]);

// Old way with allocation
let vec: Vec<_> = map.values().collect();
Expand Down Expand Up @@ -299,7 +298,7 @@ pub fn test_named(client: &mut Client) {
}

// Test we correctly implement borrowed version and copy derive
#[allow(clippy::drop_copy)]
#[allow(dropping_copy_types)]
pub fn test_copy(client: &mut Client) {
// Test copy
let copy_params = CopyComposite {
Expand Down

0 comments on commit cf32042

Please sign in to comment.