diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-18 14:37:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-18 14:37:34 +0000 |
commit | cecf25b72f2af84fc1535cf52d6f3c1b52802565 (patch) | |
tree | 37c8dde0a459caacae6629da08d86be270469ef5 /crates/ra_hir_ty/src/traits/chalk.rs | |
parent | eab80cd961919b9321e1d34343ae3f3adb0502e5 (diff) | |
parent | f6816c253b96e8436f1156d6bd6b0942ee9fb4d3 (diff) |
Merge #3220
3220: Fix clippy warnings, update Cargo.toml versions r=matklad a=SomeoneToIgnore
In the `cargo xtask lint` ouptut, there were two interesting Clippy warnings that might be interesting to investigate further:
* warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
* warning: large size difference between variants
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 882160fa8..1bdf13e48 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -409,8 +409,7 @@ where | |||
409 | fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Canonical<T::Chalk> { | 409 | fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Canonical<T::Chalk> { |
410 | let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT); | 410 | let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT); |
411 | let value = self.value.to_chalk(db); | 411 | let value = self.value.to_chalk(db); |
412 | let canonical = chalk_ir::Canonical { value, binders: vec![parameter; self.num_vars] }; | 412 | chalk_ir::Canonical { value, binders: vec![parameter; self.num_vars] } |
413 | canonical | ||
414 | } | 413 | } |
415 | 414 | ||
416 | fn from_chalk(db: &impl HirDatabase, canonical: chalk_ir::Canonical<T::Chalk>) -> Canonical<T> { | 415 | fn from_chalk(db: &impl HirDatabase, canonical: chalk_ir::Canonical<T::Chalk>) -> Canonical<T> { |
@@ -565,10 +564,10 @@ where | |||
565 | // and will panic if the trait can't be resolved. | 564 | // and will panic if the trait can't be resolved. |
566 | let mut result: Vec<_> = self | 565 | let mut result: Vec<_> = self |
567 | .db | 566 | .db |
568 | .impls_for_trait(self.krate, trait_.into()) | 567 | .impls_for_trait(self.krate, trait_) |
569 | .iter() | 568 | .iter() |
570 | .copied() | 569 | .copied() |
571 | .map(|it| Impl::ImplBlock(it.into())) | 570 | .map(Impl::ImplBlock) |
572 | .map(|impl_| impl_.to_chalk(self.db)) | 571 | .map(|impl_| impl_.to_chalk(self.db)) |
573 | .collect(); | 572 | .collect(); |
574 | 573 | ||
@@ -586,7 +585,7 @@ where | |||
586 | false // FIXME | 585 | false // FIXME |
587 | } | 586 | } |
588 | fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> { | 587 | fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> { |
589 | self.db.associated_ty_value(self.krate.into(), id) | 588 | self.db.associated_ty_value(self.krate, id) |
590 | } | 589 | } |
591 | fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<TypeFamily>> { | 590 | fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<TypeFamily>> { |
592 | vec![] | 591 | vec![] |
@@ -674,7 +673,7 @@ pub(crate) fn struct_datum_query( | |||
674 | let where_clauses = type_ctor | 673 | let where_clauses = type_ctor |
675 | .as_generic_def() | 674 | .as_generic_def() |
676 | .map(|generic_def| { | 675 | .map(|generic_def| { |
677 | let generic_params = generics(db, generic_def.into()); | 676 | let generic_params = generics(db, generic_def); |
678 | let bound_vars = Substs::bound_vars(&generic_params); | 677 | let bound_vars = Substs::bound_vars(&generic_params); |
679 | convert_where_clauses(db, generic_def, &bound_vars) | 678 | convert_where_clauses(db, generic_def, &bound_vars) |
680 | }) | 679 | }) |
@@ -805,7 +804,7 @@ fn type_alias_associated_ty_value( | |||
805 | let ty = db.ty(type_alias.into()); | 804 | let ty = db.ty(type_alias.into()); |
806 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) }; | 805 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) }; |
807 | let value = chalk_rust_ir::AssociatedTyValue { | 806 | let value = chalk_rust_ir::AssociatedTyValue { |
808 | impl_id: Impl::ImplBlock(impl_id.into()).to_chalk(db), | 807 | impl_id: Impl::ImplBlock(impl_id).to_chalk(db), |
809 | associated_ty_id: assoc_ty.to_chalk(db), | 808 | associated_ty_id: assoc_ty.to_chalk(db), |
810 | value: make_binders(value_bound, ty.num_binders), | 809 | value: make_binders(value_bound, ty.num_binders), |
811 | }; | 810 | }; |