mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Run cargo fix --edition-idioms
This commit is contained in:
parent
23d25a3094
commit
816f7fe12a
230 changed files with 888 additions and 888 deletions
|
@ -70,7 +70,7 @@ impl Iterator for Autoderef<'_, '_> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn autoderef_step(table: &mut InferenceTable, ty: Ty) -> Option<(AutoderefKind, Ty)> {
|
||||
pub(crate) fn autoderef_step(table: &mut InferenceTable<'_>, ty: Ty) -> Option<(AutoderefKind, Ty)> {
|
||||
if let Some(derefed) = builtin_deref(&ty) {
|
||||
Some((AutoderefKind::Builtin, table.resolve_ty_shallow(derefed)))
|
||||
} else {
|
||||
|
@ -94,7 +94,7 @@ pub fn autoderef<'a>(
|
|||
v.into_iter()
|
||||
}
|
||||
|
||||
pub(crate) fn deref(table: &mut InferenceTable, ty: Ty) -> Option<Ty> {
|
||||
pub(crate) fn deref(table: &mut InferenceTable<'_>, ty: Ty) -> Option<Ty> {
|
||||
let _p = profile::span("deref");
|
||||
autoderef_step(table, ty).map(|(_, ty)| ty)
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ fn builtin_deref(ty: &Ty) -> Option<&Ty> {
|
|||
}
|
||||
}
|
||||
|
||||
fn deref_by_trait(table: &mut InferenceTable, ty: Ty) -> Option<Ty> {
|
||||
fn deref_by_trait(table: &mut InferenceTable<'_>, ty: Ty) -> Option<Ty> {
|
||||
let _p = profile::span("deref_by_trait");
|
||||
if table.resolve_ty_shallow(&ty).inference_var(Interner).is_some() {
|
||||
// don't try to deref unknown variables
|
||||
|
|
|
@ -111,7 +111,7 @@ impl<D> TyBuilder<D> {
|
|||
this
|
||||
}
|
||||
|
||||
pub(crate) fn fill_with_inference_vars(self, table: &mut InferenceTable) -> Self {
|
||||
pub(crate) fn fill_with_inference_vars(self, table: &mut InferenceTable<'_>) -> Self {
|
||||
self.fill(|x| match x {
|
||||
ParamKind::Type => GenericArgData::Ty(table.new_type_var()).intern(Interner),
|
||||
ParamKind::Const(ty) => {
|
||||
|
|
|
@ -292,7 +292,7 @@ impl<'a> PatCtxt<'a> {
|
|||
}
|
||||
|
||||
impl HirDisplay for Pat {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match &*self.kind {
|
||||
PatKind::Wild => write!(f, "_"),
|
||||
PatKind::Binding { name, subpattern } => {
|
||||
|
@ -394,11 +394,11 @@ impl HirDisplay for Pat {
|
|||
|
||||
struct WriteWith<F>(F)
|
||||
where
|
||||
F: Fn(&mut HirFormatter) -> Result<(), HirDisplayError>;
|
||||
F: Fn(&mut HirFormatter<'_>) -> Result<(), HirDisplayError>;
|
||||
|
||||
impl<F> HirDisplay for WriteWith<F>
|
||||
where
|
||||
F: Fn(&mut HirFormatter) -> Result<(), HirDisplayError>,
|
||||
F: Fn(&mut HirFormatter<'_>) -> Result<(), HirDisplayError>,
|
||||
{
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
(self.0)(f)
|
||||
|
|
|
@ -144,7 +144,7 @@ impl IntRange {
|
|||
}
|
||||
}
|
||||
|
||||
fn to_pat(&self, _cx: &MatchCheckCtx, ty: Ty) -> Pat {
|
||||
fn to_pat(&self, _cx: &MatchCheckCtx<'_, '_>, ty: Ty) -> Pat {
|
||||
match ty.kind(Interner) {
|
||||
TyKind::Scalar(Scalar::Bool) => {
|
||||
let kind = match self.boundaries() {
|
||||
|
|
|
@ -45,7 +45,7 @@ pub struct HirFormatter<'a> {
|
|||
}
|
||||
|
||||
pub trait HirDisplay {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError>;
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError>;
|
||||
|
||||
/// Returns a `Display`able type that is human-readable.
|
||||
fn into_displayable<'a>(
|
||||
|
@ -162,7 +162,7 @@ impl<'a> HirFormatter<'a> {
|
|||
}
|
||||
|
||||
/// This allows using the `write!` macro directly with a `HirFormatter`.
|
||||
pub fn write_fmt(&mut self, args: fmt::Arguments) -> Result<(), HirDisplayError> {
|
||||
pub fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> Result<(), HirDisplayError> {
|
||||
// We write to a buffer first to track output size
|
||||
self.buf.clear();
|
||||
fmt::write(&mut self.buf, args)?;
|
||||
|
@ -247,7 +247,7 @@ impl<'a, T> fmt::Display for HirDisplayWrapper<'a, T>
|
|||
where
|
||||
T: HirDisplay,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.t.hir_fmt(&mut HirFormatter {
|
||||
db: self.db,
|
||||
fmt: f,
|
||||
|
@ -270,19 +270,19 @@ where
|
|||
const TYPE_HINT_TRUNCATION: &str = "…";
|
||||
|
||||
impl<T: HirDisplay> HirDisplay for &'_ T {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
HirDisplay::hir_fmt(*self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: HirDisplay + Internable> HirDisplay for Interned<T> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
HirDisplay::hir_fmt(self.as_ref(), f)
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for ProjectionTy {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
return write!(f, "{}", TYPE_HINT_TRUNCATION);
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ impl HirDisplay for ProjectionTy {
|
|||
}
|
||||
|
||||
impl HirDisplay for OpaqueTy {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
return write!(f, "{}", TYPE_HINT_TRUNCATION);
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ impl HirDisplay for OpaqueTy {
|
|||
}
|
||||
|
||||
impl HirDisplay for GenericArg {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self.interned() {
|
||||
crate::GenericArgData::Ty(ty) => ty.hir_fmt(f),
|
||||
crate::GenericArgData::Lifetime(lt) => lt.hir_fmt(f),
|
||||
|
@ -322,7 +322,7 @@ impl HirDisplay for GenericArg {
|
|||
}
|
||||
|
||||
impl HirDisplay for Const {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
let data = self.interned();
|
||||
match data.value {
|
||||
ConstValue::BoundVar(idx) => idx.hir_fmt(f),
|
||||
|
@ -339,13 +339,13 @@ impl HirDisplay for Const {
|
|||
}
|
||||
|
||||
impl HirDisplay for BoundVar {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
write!(f, "?{}.{}", self.debruijn.depth(), self.index)
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for Ty {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
return write!(f, "{}", TYPE_HINT_TRUNCATION);
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ impl HirDisplay for Ty {
|
|||
}
|
||||
|
||||
impl HirDisplay for CallableSig {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
write!(f, "fn(")?;
|
||||
f.write_joined(self.params(), ", ")?;
|
||||
if self.is_varargs {
|
||||
|
@ -839,7 +839,7 @@ pub fn write_bounds_like_dyn_trait_with_prefix(
|
|||
prefix: &str,
|
||||
predicates: &[QuantifiedWhereClause],
|
||||
default_sized: SizedByDefault,
|
||||
f: &mut HirFormatter,
|
||||
f: &mut HirFormatter<'_>,
|
||||
) -> Result<(), HirDisplayError> {
|
||||
write!(f, "{}", prefix)?;
|
||||
if !predicates.is_empty()
|
||||
|
@ -855,7 +855,7 @@ pub fn write_bounds_like_dyn_trait_with_prefix(
|
|||
fn write_bounds_like_dyn_trait(
|
||||
predicates: &[QuantifiedWhereClause],
|
||||
default_sized: SizedByDefault,
|
||||
f: &mut HirFormatter,
|
||||
f: &mut HirFormatter<'_>,
|
||||
) -> Result<(), HirDisplayError> {
|
||||
// Note: This code is written to produce nice results (i.e.
|
||||
// corresponding to surface Rust) for types that can occur in
|
||||
|
@ -952,7 +952,7 @@ fn write_bounds_like_dyn_trait(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn fmt_trait_ref(tr: &TraitRef, f: &mut HirFormatter, use_as: bool) -> Result<(), HirDisplayError> {
|
||||
fn fmt_trait_ref(tr: &TraitRef, f: &mut HirFormatter<'_>, use_as: bool) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
return write!(f, "{}", TYPE_HINT_TRUNCATION);
|
||||
}
|
||||
|
@ -973,13 +973,13 @@ fn fmt_trait_ref(tr: &TraitRef, f: &mut HirFormatter, use_as: bool) -> Result<()
|
|||
}
|
||||
|
||||
impl HirDisplay for TraitRef {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
fmt_trait_ref(self, f, false)
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for WhereClause {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
if f.should_truncate() {
|
||||
return write!(f, "{}", TYPE_HINT_TRUNCATION);
|
||||
}
|
||||
|
@ -1007,7 +1007,7 @@ impl HirDisplay for WhereClause {
|
|||
}
|
||||
|
||||
impl HirDisplay for LifetimeOutlives {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
self.a.hir_fmt(f)?;
|
||||
write!(f, ": ")?;
|
||||
self.b.hir_fmt(f)
|
||||
|
@ -1015,13 +1015,13 @@ impl HirDisplay for LifetimeOutlives {
|
|||
}
|
||||
|
||||
impl HirDisplay for Lifetime {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
self.interned().hir_fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl HirDisplay for LifetimeData {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self {
|
||||
LifetimeData::BoundVar(idx) => idx.hir_fmt(f),
|
||||
LifetimeData::InferenceVar(_) => write!(f, "_"),
|
||||
|
@ -1040,7 +1040,7 @@ impl HirDisplay for LifetimeData {
|
|||
}
|
||||
|
||||
impl HirDisplay for DomainGoal {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self {
|
||||
DomainGoal::Holds(wc) => {
|
||||
write!(f, "Holds(")?;
|
||||
|
@ -1056,7 +1056,7 @@ impl HirDisplay for DomainGoal {
|
|||
pub fn write_visibility(
|
||||
module_id: ModuleId,
|
||||
vis: Visibility,
|
||||
f: &mut HirFormatter,
|
||||
f: &mut HirFormatter<'_>,
|
||||
) -> Result<(), HirDisplayError> {
|
||||
match vis {
|
||||
Visibility::Public => write!(f, "pub "),
|
||||
|
@ -1078,7 +1078,7 @@ pub fn write_visibility(
|
|||
}
|
||||
|
||||
impl HirDisplay for TypeRef {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self {
|
||||
TypeRef::Never => write!(f, "!")?,
|
||||
TypeRef::Placeholder => write!(f, "_")?,
|
||||
|
@ -1177,7 +1177,7 @@ impl HirDisplay for TypeRef {
|
|||
}
|
||||
|
||||
impl HirDisplay for TypeBound {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self {
|
||||
TypeBound::Path(path, modifier) => {
|
||||
match modifier {
|
||||
|
@ -1197,7 +1197,7 @@ impl HirDisplay for TypeBound {
|
|||
}
|
||||
|
||||
impl HirDisplay for Path {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match (self.type_anchor(), self.kind()) {
|
||||
(Some(anchor), _) => {
|
||||
write!(f, "<")?;
|
||||
|
@ -1301,7 +1301,7 @@ impl HirDisplay for Path {
|
|||
}
|
||||
|
||||
impl HirDisplay for hir_def::path::GenericArg {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> {
|
||||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match self {
|
||||
hir_def::path::GenericArg::Type(ty) => ty.hir_fmt(f),
|
||||
hir_def::path::GenericArg::Const(c) => write!(f, "{}", c),
|
||||
|
|
|
@ -130,7 +130,7 @@ trait PatLike: Into<ExprOrPatId> + Copy {
|
|||
type BindingMode: Copy;
|
||||
|
||||
fn infer(
|
||||
this: &mut InferenceContext,
|
||||
this: &mut InferenceContext<'_>,
|
||||
id: Self,
|
||||
expected_ty: &Ty,
|
||||
default_bm: Self::BindingMode,
|
||||
|
@ -140,7 +140,7 @@ trait PatLike: Into<ExprOrPatId> + Copy {
|
|||
impl PatLike for ExprId {
|
||||
type BindingMode = ();
|
||||
|
||||
fn infer(this: &mut InferenceContext, id: Self, expected_ty: &Ty, _: Self::BindingMode) -> Ty {
|
||||
fn infer(this: &mut InferenceContext<'_>, id: Self, expected_ty: &Ty, _: Self::BindingMode) -> Ty {
|
||||
this.infer_assignee_expr(id, expected_ty)
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ impl PatLike for PatId {
|
|||
type BindingMode = BindingMode;
|
||||
|
||||
fn infer(
|
||||
this: &mut InferenceContext,
|
||||
this: &mut InferenceContext<'_>,
|
||||
id: Self,
|
||||
expected_ty: &Ty,
|
||||
default_bm: Self::BindingMode,
|
||||
|
@ -971,7 +971,7 @@ impl Expectation {
|
|||
/// which still is useful, because it informs integer literals and the like.
|
||||
/// See the test case `test/ui/coerce-expect-unsized.rs` and #20169
|
||||
/// for examples of where this comes up,.
|
||||
fn rvalue_hint(table: &mut unify::InferenceTable, ty: Ty) -> Self {
|
||||
fn rvalue_hint(table: &mut unify::InferenceTable<'_>, ty: Ty) -> Self {
|
||||
// FIXME: do struct_tail_without_normalization
|
||||
match table.resolve_ty_shallow(&ty).kind(Interner) {
|
||||
TyKind::Slice(_) | TyKind::Str | TyKind::Dyn(_) => Expectation::RValueLikeUnsized(ty),
|
||||
|
@ -984,7 +984,7 @@ impl Expectation {
|
|||
Expectation::None
|
||||
}
|
||||
|
||||
fn resolve(&self, table: &mut unify::InferenceTable) -> Expectation {
|
||||
fn resolve(&self, table: &mut unify::InferenceTable<'_>) -> Expectation {
|
||||
match self {
|
||||
Expectation::None => Expectation::None,
|
||||
Expectation::HasType(t) => Expectation::HasType(table.resolve_ty_shallow(t)),
|
||||
|
@ -994,7 +994,7 @@ impl Expectation {
|
|||
}
|
||||
}
|
||||
|
||||
fn to_option(&self, table: &mut unify::InferenceTable) -> Option<Ty> {
|
||||
fn to_option(&self, table: &mut unify::InferenceTable<'_>) -> Option<Ty> {
|
||||
match self.resolve(table) {
|
||||
Expectation::None => None,
|
||||
Expectation::HasType(t) |
|
||||
|
@ -1003,7 +1003,7 @@ impl Expectation {
|
|||
}
|
||||
}
|
||||
|
||||
fn only_has_type(&self, table: &mut unify::InferenceTable) -> Option<Ty> {
|
||||
fn only_has_type(&self, table: &mut unify::InferenceTable<'_>) -> Option<Ty> {
|
||||
match self {
|
||||
Expectation::HasType(t) => Some(table.resolve_ty_shallow(t)),
|
||||
// Expectation::Castable(_) |
|
||||
|
@ -1028,7 +1028,7 @@ impl Expectation {
|
|||
/// an expected type. Otherwise, we might write parts of the type
|
||||
/// when checking the 'then' block which are incompatible with the
|
||||
/// 'else' branch.
|
||||
fn adjust_for_branches(&self, table: &mut unify::InferenceTable) -> Expectation {
|
||||
fn adjust_for_branches(&self, table: &mut unify::InferenceTable<'_>) -> Expectation {
|
||||
match self {
|
||||
Expectation::HasType(ety) => {
|
||||
let ety = table.resolve_ty_shallow(ety);
|
||||
|
|
|
@ -43,7 +43,7 @@ where
|
|||
impl<T: HasInterner<Interner = Interner>> Canonicalized<T> {
|
||||
pub(super) fn apply_solution(
|
||||
&self,
|
||||
ctx: &mut InferenceTable,
|
||||
ctx: &mut InferenceTable<'_>,
|
||||
solution: Canonical<Substitution>,
|
||||
) {
|
||||
// the solution may contain new variables, which we need to convert to new inference vars
|
||||
|
@ -391,7 +391,7 @@ impl<'a> InferenceTable<'a> {
|
|||
self.pending_obligations = snapshot.pending_obligations;
|
||||
}
|
||||
|
||||
pub(crate) fn run_in_snapshot<T>(&mut self, f: impl FnOnce(&mut InferenceTable) -> T) -> T {
|
||||
pub(crate) fn run_in_snapshot<T>(&mut self, f: impl FnOnce(&mut InferenceTable<'_>) -> T) -> T {
|
||||
let snapshot = self.snapshot();
|
||||
let result = f(self);
|
||||
self.rollback_to(snapshot);
|
||||
|
|
|
@ -168,7 +168,7 @@ impl chalk_ir::interner::Interner for Interner {
|
|||
}
|
||||
|
||||
fn debug_separator_trait_ref(
|
||||
separator_trait_ref: &chalk_ir::SeparatorTraitRef<Interner>,
|
||||
separator_trait_ref: &chalk_ir::SeparatorTraitRef<'_, Interner>,
|
||||
fmt: &mut fmt::Formatter<'_>,
|
||||
) -> Option<fmt::Result> {
|
||||
Some(write!(fmt, "{:?}", separator_trait_ref.debug(Interner)))
|
||||
|
|
|
@ -106,7 +106,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||
pub fn with_debruijn<T>(
|
||||
&self,
|
||||
debruijn: DebruijnIndex,
|
||||
f: impl FnOnce(&TyLoweringContext) -> T,
|
||||
f: impl FnOnce(&TyLoweringContext<'_>) -> T,
|
||||
) -> T {
|
||||
let opaque_ty_data_vec = self.opaque_type_data.take();
|
||||
let expander = self.expander.take();
|
||||
|
@ -130,7 +130,7 @@ impl<'a> TyLoweringContext<'a> {
|
|||
pub fn with_shifted_in<T>(
|
||||
&self,
|
||||
debruijn: DebruijnIndex,
|
||||
f: impl FnOnce(&TyLoweringContext) -> T,
|
||||
f: impl FnOnce(&TyLoweringContext<'_>) -> T,
|
||||
) -> T {
|
||||
self.with_debruijn(self.in_binders.shifted_in_from(debruijn), f)
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ pub struct ReceiverAdjustments {
|
|||
}
|
||||
|
||||
impl ReceiverAdjustments {
|
||||
pub(crate) fn apply(&self, table: &mut InferenceTable, ty: Ty) -> (Ty, Vec<Adjustment>) {
|
||||
pub(crate) fn apply(&self, table: &mut InferenceTable<'_>, ty: Ty) -> (Ty, Vec<Adjustment>) {
|
||||
let mut ty = ty;
|
||||
let mut adjust = Vec::new();
|
||||
for _ in 0..self.autoderefs {
|
||||
|
@ -597,7 +597,7 @@ pub fn lookup_impl_method(
|
|||
|
||||
fn find_matching_impl(
|
||||
mut impls: impl Iterator<Item = ImplId>,
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
self_ty: &Ty,
|
||||
) -> Option<Arc<ImplData>> {
|
||||
let db = table.db;
|
||||
|
@ -856,7 +856,7 @@ fn iterate_method_candidates_for_self_ty(
|
|||
|
||||
fn iterate_trait_method_candidates(
|
||||
self_ty: &Ty,
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
traits_in_scope: &FxHashSet<TraitId>,
|
||||
name: Option<&Name>,
|
||||
receiver_ty: Option<&Ty>,
|
||||
|
@ -922,7 +922,7 @@ fn iterate_trait_method_candidates(
|
|||
|
||||
fn iterate_inherent_methods(
|
||||
self_ty: &Ty,
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
name: Option<&Name>,
|
||||
receiver_ty: Option<&Ty>,
|
||||
receiver_adjustments: Option<ReceiverAdjustments>,
|
||||
|
@ -975,7 +975,7 @@ fn iterate_inherent_methods(
|
|||
fn impls_for_self_ty(
|
||||
impls: &InherentImpls,
|
||||
self_ty: &Ty,
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
name: Option<&Name>,
|
||||
receiver_ty: Option<&Ty>,
|
||||
receiver_adjustments: Option<ReceiverAdjustments>,
|
||||
|
@ -1017,7 +1017,7 @@ pub fn resolve_indexing_op(
|
|||
}
|
||||
|
||||
fn is_valid_candidate(
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
name: Option<&Name>,
|
||||
receiver_ty: Option<&Ty>,
|
||||
item: AssocItemId,
|
||||
|
@ -1161,7 +1161,7 @@ fn generic_implements_goal(
|
|||
}
|
||||
|
||||
fn autoderef_method_receiver(
|
||||
table: &mut InferenceTable,
|
||||
table: &mut InferenceTable<'_>,
|
||||
ty: Ty,
|
||||
) -> (Vec<Canonical<Ty>>, Vec<ReceiverAdjustments>) {
|
||||
let (mut deref_chain, mut adjustments): (Vec<_>, Vec<_>) = (Vec::new(), Vec::new());
|
||||
|
|
|
@ -77,7 +77,7 @@ impl FileLoader for TestDB {
|
|||
fn file_text(&self, file_id: FileId) -> Arc<String> {
|
||||
FileLoaderDelegate(self).file_text(file_id)
|
||||
}
|
||||
fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> {
|
||||
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId> {
|
||||
FileLoaderDelegate(self).resolve_path(path)
|
||||
}
|
||||
fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>> {
|
||||
|
|
|
@ -104,7 +104,7 @@ mod unsafe_tls {
|
|||
use crate::db::HirDatabase;
|
||||
use scoped_tls::scoped_thread_local;
|
||||
|
||||
scoped_thread_local!(static PROGRAM: DebugContext);
|
||||
scoped_thread_local!(static PROGRAM: DebugContext<'_>);
|
||||
|
||||
pub(crate) fn with_current_program<R>(
|
||||
op: impl for<'a> FnOnce(Option<&'a DebugContext<'a>>) -> R,
|
||||
|
@ -127,7 +127,7 @@ mod unsafe_tls {
|
|||
// `with_current_program`, which hides the lifetime through the `for`
|
||||
// type.
|
||||
let static_p: &DebugContext<'static> =
|
||||
unsafe { std::mem::transmute::<&DebugContext, &DebugContext<'static>>(&ctx) };
|
||||
unsafe { std::mem::transmute::<&DebugContext<'_>, &DebugContext<'static>>(&ctx) };
|
||||
PROGRAM.set(static_p, op)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ pub fn all_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> SmallVec<[Trai
|
|||
/// `all_super_traits` is that we keep track of type parameters; for example if
|
||||
/// we have `Self: Trait<u32, i32>` and `Trait<T, U>: OtherTrait<U>` we'll get
|
||||
/// `Self: OtherTrait<i32>`.
|
||||
pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> SuperTraits {
|
||||
pub(super) fn all_super_trait_refs(db: &dyn HirDatabase, trait_ref: TraitRef) -> SuperTraits<'_> {
|
||||
SuperTraits { db, seen: iter::once(trait_ref.trait_id).collect(), stack: vec![trait_ref] }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue