mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
cargo clippy --fix
This commit is contained in:
parent
1ab8c7fd27
commit
fad4fa163c
178 changed files with 595 additions and 738 deletions
|
@ -88,7 +88,7 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer
|
|||
DefWithBodyId::StaticId(s) => ctx.collect_static(&db.static_data(s)),
|
||||
DefWithBodyId::VariantId(v) => {
|
||||
ctx.return_ty = TyBuilder::builtin(
|
||||
match db.enum_data(v.lookup(db.upcast()).parent.into()).variant_body_type() {
|
||||
match db.enum_data(v.lookup(db.upcast()).parent).variant_body_type() {
|
||||
hir_def::layout::IntegerType::Pointer(signed) => match signed {
|
||||
true => BuiltinType::Int(BuiltinInt::Isize),
|
||||
false => BuiltinType::Uint(BuiltinUint::Usize),
|
||||
|
@ -156,8 +156,9 @@ pub(crate) fn normalize(db: &dyn HirDatabase, trait_env: Arc<TraitEnvironment>,
|
|||
|
||||
/// Binding modes inferred for patterns.
|
||||
/// <https://doc.rust-lang.org/reference/patterns.html#binding-modes>
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
|
||||
pub enum BindingMode {
|
||||
#[default]
|
||||
Move,
|
||||
Ref(Mutability),
|
||||
}
|
||||
|
@ -172,12 +173,6 @@ impl BindingMode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for BindingMode {
|
||||
fn default() -> Self {
|
||||
BindingMode::Move
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct InferOk<T> {
|
||||
value: T,
|
||||
|
@ -572,10 +567,10 @@ enum BreakableKind {
|
|||
Border,
|
||||
}
|
||||
|
||||
fn find_breakable<'c>(
|
||||
ctxs: &'c mut [BreakableContext],
|
||||
fn find_breakable(
|
||||
ctxs: &mut [BreakableContext],
|
||||
label: Option<LabelId>,
|
||||
) -> Option<&'c mut BreakableContext> {
|
||||
) -> Option<&mut BreakableContext> {
|
||||
let mut ctxs = ctxs
|
||||
.iter_mut()
|
||||
.rev()
|
||||
|
@ -586,10 +581,10 @@ fn find_breakable<'c>(
|
|||
}
|
||||
}
|
||||
|
||||
fn find_continuable<'c>(
|
||||
ctxs: &'c mut [BreakableContext],
|
||||
fn find_continuable(
|
||||
ctxs: &mut [BreakableContext],
|
||||
label: Option<LabelId>,
|
||||
) -> Option<&'c mut BreakableContext> {
|
||||
) -> Option<&mut BreakableContext> {
|
||||
match label {
|
||||
Some(_) => find_breakable(ctxs, label).filter(|it| matches!(it.kind, BreakableKind::Loop)),
|
||||
None => find_breakable(ctxs, label),
|
||||
|
@ -825,8 +820,8 @@ impl<'a> InferenceContext<'a> {
|
|||
ImplTraitId::ReturnTypeImplTrait(_, idx) => idx,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let bounds = (*rpits)
|
||||
.map_ref(|rpits| rpits.impl_traits[idx].bounds.map_ref(|it| it.into_iter()));
|
||||
let bounds =
|
||||
(*rpits).map_ref(|rpits| rpits.impl_traits[idx].bounds.map_ref(|it| it.iter()));
|
||||
let var = self.table.new_type_var();
|
||||
let var_subst = Substitution::from1(Interner, var.clone());
|
||||
for bound in bounds {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue