Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MinerSebas committed Feb 8, 2024
1 parent 5e1177d commit 58a4d75
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/system_lints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fn recursively_resolve_world_query<'tcx>(
}
rustc_middle::ty::TyKind::Ref(_, _, _) => world
.strip_reference()
.map(|(ty, mutbl)| WorldQuery::Data(ty.middle.kind().clone(), mutbl, world.span())),
.map(|(ty, mutbl)| WorldQuery::Data(*ty.middle.kind(), mutbl, world.span())),
_ => None,
}
}
Expand Down Expand Up @@ -230,7 +230,7 @@ fn recursively_resolve_filter_query<'tcx>(
let generics = filter.extract_generics_from_struct().unwrap();
assert_eq!(generics.len(), 1);

let filter_query = constructor(generics[0].middle.kind().clone(), filter.span());
let filter_query = constructor(*generics[0].middle.kind(), filter.span());

filter_query
})
Expand Down
8 changes: 4 additions & 4 deletions src/system_lints/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ impl<'tcx> WorldQuery<'tcx> {
}
WorldQuery::Data(kind, _, _) => {
if let rustc_middle::ty::TyKind::Alias(_, projection) = kind {
let target = projection.args.get(0).unwrap().expect_ty().kind();
let target = projection.args.first().unwrap().expect_ty().kind();

match target {
rustc_middle::ty::TyKind::Param(param)
if param.name == Symbol::intern("Self") =>
{ /* Do nothing here, to avoid turning associative types into self. */ }
_ => *kind = target.clone(),
_ => *kind = *target,
}
}
}
Expand Down Expand Up @@ -108,13 +108,13 @@ impl<'tcx> FilterQuery<'tcx> {
| FilterQuery::Added(kind, _)
| FilterQuery::Changed(kind, _) => {
if let rustc_middle::ty::TyKind::Alias(_, projection) = kind {
let target = projection.args.get(0).unwrap().expect_ty().kind();
let target = projection.args.first().unwrap().expect_ty().kind();

match target {
rustc_middle::ty::TyKind::Param(param)
if param.name == Symbol::intern("Self") =>
{ /* Do nothing here, to avoid turning associative types into self. */ }
_ => *kind = target.clone(),
_ => *kind = *target,
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/system_lints/query_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl<'tcx> QueryData<'tcx> {
self.fill_with_world_query(ctx, world_query);
}
}
WorldQuery::Data(ty_kind, mutbl, span) => match self.data.entry(ty_kind.clone()) {
WorldQuery::Data(ty_kind, mutbl, span) => match self.data.entry(*ty_kind) {
Entry::Vacant(e) => {
e.insert(vec![(*mutbl, *span)]);
}
Expand Down Expand Up @@ -369,31 +369,31 @@ impl<'tcx> QueryData<'tcx> {
}
self.or.push((vec, *span));
}
FilterQuery::With(ty_kind, span) => match self.with.entry(ty_kind.clone()) {
FilterQuery::With(ty_kind, span) => match self.with.entry(*ty_kind) {
Entry::Vacant(e) => {
e.insert(vec![*span]);
}
Entry::Occupied(mut e) => {
e.get_mut().push(*span);
}
},
FilterQuery::Without(ty_kind, span) => match self.without.entry(ty_kind.clone()) {
FilterQuery::Without(ty_kind, span) => match self.without.entry(*ty_kind) {
Entry::Vacant(e) => {
e.insert(vec![*span]);
}
Entry::Occupied(mut e) => {
e.get_mut().push(*span);
}
},
FilterQuery::Added(ty_kind, span) => match self.added.entry(ty_kind.clone()) {
FilterQuery::Added(ty_kind, span) => match self.added.entry(*ty_kind) {
Entry::Vacant(e) => {
e.insert(vec![*span]);
}
Entry::Occupied(mut e) => {
e.get_mut().push(*span);
}
},
FilterQuery::Changed(ty_kind, span) => match self.changed.entry(ty_kind.clone()) {
FilterQuery::Changed(ty_kind, span) => match self.changed.entry(*ty_kind) {
Entry::Vacant(e) => {
e.insert(vec![*span]);
}
Expand Down

0 comments on commit 58a4d75

Please sign in to comment.