Skip to content

Commit a8755b9

Browse files
committed
Fix new nightly lints
1 parent 2324324 commit a8755b9

File tree

23 files changed

+79
-49
lines changed

23 files changed

+79
-49
lines changed

crates/hir-def/src/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<'a> OuterImplTraitGuard<'a> {
3434
}
3535
}
3636

37-
impl<'a> Drop for OuterImplTraitGuard<'a> {
37+
impl Drop for OuterImplTraitGuard<'_> {
3838
fn drop(&mut self) {
3939
self.ctx.outer_impl_trait.replace(self.old);
4040
}

crates/hir-expand/src/hygiene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pub(crate) fn dump_syntax_contexts(db: &dyn ExpandDatabase) -> String {
227227
&'a SyntaxContextData,
228228
);
229229

230-
impl<'a> std::fmt::Debug for SyntaxContextDebug<'a> {
230+
impl std::fmt::Debug for SyntaxContextDebug<'_> {
231231
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
232232
fancy_debug(self.2, self.1, self.0, f)
233233
}

crates/hir-ty/src/autoderef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'table, 'db> Autoderef<'table, 'db, usize> {
114114
}
115115

116116
#[allow(private_bounds)]
117-
impl<'table, 'db, T: TrackAutoderefSteps> Autoderef<'table, 'db, T> {
117+
impl<T: TrackAutoderefSteps> Autoderef<'_, '_, T> {
118118
pub(crate) fn step_count(&self) -> usize {
119119
self.steps.len()
120120
}

crates/hir-ty/src/chalk_db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
521521
}
522522
}
523523

524-
impl<'a> ChalkContext<'a> {
524+
impl ChalkContext<'_> {
525525
fn edition(&self) -> Edition {
526526
self.db.crate_graph()[self.krate].edition
527527
}

crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'db> PatCx for MatchCheckCtx<'db> {
519519
}
520520
}
521521

522-
impl<'db> fmt::Debug for MatchCheckCtx<'db> {
522+
impl fmt::Debug for MatchCheckCtx<'_> {
523523
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
524524
f.debug_struct("MatchCheckCtx").finish()
525525
}

crates/hir-ty/src/dyn_compatibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn contains_illegal_self_type_reference<T: TypeVisitable<Interner>>(
266266
trait_self_param_idx: usize,
267267
allow_self_projection: AllowSelfProjection,
268268
}
269-
impl<'a> TypeVisitor<Interner> for IllegalSelfTypeVisitor<'a> {
269+
impl TypeVisitor<Interner> for IllegalSelfTypeVisitor<'_> {
270270
type BreakTy = ();
271271

272272
fn as_dyn(&mut self) -> &mut dyn TypeVisitor<Interner, BreakTy = Self::BreakTy> {

crates/hir-ty/src/infer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ impl<'a> InferenceContext<'a> {
10221022
non_assocs: FxHashMap<OpaqueTyId, Ty>,
10231023
}
10241024

1025-
impl<'a, 'b> TypeVisitor<Interner> for TypeAliasImplTraitCollector<'a, 'b> {
1025+
impl TypeVisitor<Interner> for TypeAliasImplTraitCollector<'_, '_> {
10261026
type BreakTy = ();
10271027

10281028
fn as_dyn(&mut self) -> &mut dyn TypeVisitor<Interner, BreakTy = Self::BreakTy> {

crates/hir-ty/src/mir.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,8 @@ pub enum Rvalue {
879879
///
880880
/// **Needs clarification**: Are there weird additional semantics here related to the runtime
881881
/// nature of this operation?
882-
//ThreadLocalRef(DefId),
882+
// ThreadLocalRef(DefId),
883+
ThreadLocalRef(std::convert::Infallible),
883884

884885
/// Creates a pointer with the indicated mutability to the place.
885886
///
@@ -888,7 +889,8 @@ pub enum Rvalue {
888889
///
889890
/// Like with references, the semantics of this operation are heavily dependent on the aliasing
890891
/// model.
891-
//AddressOf(Mutability, Place),
892+
// AddressOf(Mutability, Place),
893+
AddressOf(std::convert::Infallible),
892894

893895
/// Yields the length of the place, as a `usize`.
894896
///
@@ -906,19 +908,21 @@ pub enum Rvalue {
906908
Cast(CastKind, Operand, Ty),
907909

908910
// FIXME link to `pointer::offset` when it hits stable.
909-
// /// * `Offset` has the same semantics as `pointer::offset`, except that the second
910-
// /// parameter may be a `usize` as well.
911-
// /// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
912-
// /// raw pointers, or function pointers and return a `bool`. The types of the operands must be
913-
// /// matching, up to the usual caveat of the lifetimes in function pointers.
914-
// /// * Left and right shift operations accept signed or unsigned integers not necessarily of the
915-
// /// same type and return a value of the same type as their LHS. Like in Rust, the RHS is
916-
// /// truncated as needed.
917-
// /// * The `Bit*` operations accept signed integers, unsigned integers, or bools with matching
918-
// /// types and return a value of that type.
919-
// /// * The remaining operations accept signed integers, unsigned integers, or floats with
920-
// /// matching types and return a value of that type.
911+
/// * `Offset` has the same semantics as `pointer::offset`, except that the second
912+
/// parameter may be a `usize` as well.
913+
/// * The comparison operations accept `bool`s, `char`s, signed or unsigned integers, floats,
914+
/// raw pointers, or function pointers and return a `bool`. The types of the operands must be
915+
/// matching, up to the usual caveat of the lifetimes in function pointers.
916+
/// * Left and right shift operations accept signed or unsigned integers not necessarily of the
917+
/// same type and return a value of the same type as their LHS. Like in Rust, the RHS is
918+
/// truncated as needed.
919+
/// * The `Bit*` operations accept signed integers, unsigned integers, or bools with matching
920+
/// types and return a value of that type.
921+
/// * The remaining operations accept signed integers, unsigned integers, or floats with
922+
/// matching types and return a value of that type.
921923
//BinaryOp(BinOp, Box<(Operand, Operand)>),
924+
BinaryOp(std::convert::Infallible),
925+
922926
/// Same as `BinaryOp`, but yields `(T, bool)` with a `bool` indicating an error condition.
923927
///
924928
/// When overflow checking is disabled and we are generating run-time code, the error condition
@@ -937,6 +941,7 @@ pub enum Rvalue {
937941

938942
/// Computes a value as described by the operation.
939943
//NullaryOp(NullOp, Ty),
944+
NullaryOp(std::convert::Infallible),
940945

941946
/// Exactly like `BinaryOp`, but less operands.
942947
///
@@ -1095,6 +1100,10 @@ impl MirBody {
10951100
for_operand(op, &mut f, &mut self.projection_store);
10961101
}
10971102
}
1103+
Rvalue::ThreadLocalRef(n)
1104+
| Rvalue::AddressOf(n)
1105+
| Rvalue::BinaryOp(n)
1106+
| Rvalue::NullaryOp(n) => match *n {},
10981107
}
10991108
}
11001109
StatementKind::FakeRead(p) | StatementKind::Deinit(p) => {

crates/hir-ty/src/mir/borrowck.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ fn moved_out_of_ref(db: &dyn HirDatabase, body: &MirBody) -> Vec<MovedOutOfRef>
167167
for_operand(op, statement.span);
168168
}
169169
}
170+
Rvalue::ThreadLocalRef(n)
171+
| Rvalue::AddressOf(n)
172+
| Rvalue::BinaryOp(n)
173+
| Rvalue::NullaryOp(n) => match *n {},
170174
},
171175
StatementKind::FakeRead(_)
172176
| StatementKind::Deinit(_)
@@ -253,6 +257,10 @@ fn partially_moved(db: &dyn HirDatabase, body: &MirBody) -> Vec<PartiallyMoved>
253257
for_operand(op, statement.span);
254258
}
255259
}
260+
Rvalue::ThreadLocalRef(n)
261+
| Rvalue::AddressOf(n)
262+
| Rvalue::BinaryOp(n)
263+
| Rvalue::NullaryOp(n) => match *n {},
256264
},
257265
StatementKind::FakeRead(_)
258266
| StatementKind::Deinit(_)
@@ -548,6 +556,10 @@ fn mutability_of_locals(
548556
}
549557
}
550558
Rvalue::ShallowInitBox(_, _) | Rvalue::ShallowInitBoxWithAlloc(_) => (),
559+
Rvalue::ThreadLocalRef(n)
560+
| Rvalue::AddressOf(n)
561+
| Rvalue::BinaryOp(n)
562+
| Rvalue::NullaryOp(n) => match *n {},
551563
}
552564
if let Rvalue::Ref(
553565
BorrowKind::Mut {

crates/hir-ty/src/mir/eval.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,10 @@ impl Evaluator<'_> {
16281628
}
16291629
CastKind::FnPtrToPtr => not_supported!("fn ptr to ptr cast"),
16301630
},
1631+
Rvalue::ThreadLocalRef(n)
1632+
| Rvalue::AddressOf(n)
1633+
| Rvalue::BinaryOp(n)
1634+
| Rvalue::NullaryOp(n) => match *n {},
16311635
})
16321636
}
16331637

@@ -2703,17 +2707,15 @@ impl Evaluator<'_> {
27032707
TyKind::Function(_) => {
27042708
self.exec_fn_pointer(func_data, destination, &args[1..], locals, target_bb, span)
27052709
}
2706-
TyKind::Closure(closure, subst) => {
2707-
return self.exec_closure(
2708-
*closure,
2709-
func_data,
2710-
&Substitution::from_iter(Interner, ClosureSubst(subst).parent_subst()),
2711-
destination,
2712-
&args[1..],
2713-
locals,
2714-
span,
2715-
);
2716-
}
2710+
TyKind::Closure(closure, subst) => self.exec_closure(
2711+
*closure,
2712+
func_data,
2713+
&Substitution::from_iter(Interner, ClosureSubst(subst).parent_subst()),
2714+
destination,
2715+
&args[1..],
2716+
locals,
2717+
span,
2718+
),
27172719
_ => {
27182720
// try to execute the manual impl of `FnTrait` for structs (nightly feature used in std)
27192721
let arg0 = func;

crates/hir-ty/src/mir/monomorphization.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ impl Filler<'_> {
258258
| Rvalue::UnaryOp(_, _)
259259
| Rvalue::Discriminant(_)
260260
| Rvalue::CopyForDeref(_) => (),
261+
Rvalue::ThreadLocalRef(n)
262+
| Rvalue::AddressOf(n)
263+
| Rvalue::BinaryOp(n)
264+
| Rvalue::NullaryOp(n) => match *n {},
261265
},
262266
StatementKind::Deinit(_)
263267
| StatementKind::FakeRead(_)

crates/hir-ty/src/mir/pretty.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,10 @@ impl<'a> MirPrettyCtx<'a> {
459459
self.place(p);
460460
w!(self, ")");
461461
}
462+
Rvalue::ThreadLocalRef(n)
463+
| Rvalue::AddressOf(n)
464+
| Rvalue::BinaryOp(n)
465+
| Rvalue::NullaryOp(n) => match *n {},
462466
}
463467
}
464468

crates/hir-ty/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub(super) struct ClauseElaborator<'a> {
123123
seen: FxHashSet<WhereClause>,
124124
}
125125

126-
impl<'a> ClauseElaborator<'a> {
126+
impl ClauseElaborator<'_> {
127127
fn extend_deduped(&mut self, clauses: impl IntoIterator<Item = WhereClause>) {
128128
self.stack.extend(clauses.into_iter().filter(|c| self.seen.insert(c.clone())))
129129
}

crates/hir/src/semantics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'db, DB> ops::Deref for Semantics<'db, DB> {
154154
}
155155
}
156156

157-
impl<'db, DB: HirDatabase> Semantics<'db, DB> {
157+
impl<DB: HirDatabase> Semantics<'_, DB> {
158158
pub fn new(db: &DB) -> Semantics<'_, DB> {
159159
let impl_ = SemanticsImpl::new(db);
160160
Semantics { db, imp: impl_ }

crates/parser/src/grammar/patterns.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
4040
pattern_r(p, recovery_set);
4141
}
4242

43-
/// Parses a pattern list separated by pipes `|`, with no leading `|`,using the
44-
/// given `recovery_set`.
45-
4643
// test or_pattern
4744
// fn main() {
4845
// match () {
@@ -52,6 +49,8 @@ pub(super) fn pattern_top_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
5249
// [_ | _,] => (),
5350
// }
5451
// }
52+
/// Parses a pattern list separated by pipes `|`, with no leading `|`,using the
53+
/// given `recovery_set`.
5554
fn pattern_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
5655
let m = p.start();
5756
pattern_single_r(p, recovery_set);

crates/proc-macro-api/src/msg/flat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ struct Writer<'a, 'span, S: InternableSpan> {
401401
text: Vec<String>,
402402
}
403403

404-
impl<'a, 'span, S: InternableSpan> Writer<'a, 'span, S> {
404+
impl<'a, S: InternableSpan> Writer<'a, '_, S> {
405405
fn write(&mut self, root: &'a tt::Subtree<S>) {
406406
self.enqueue(root);
407407
while let Some((idx, subtree)) = self.work.pop_front() {
@@ -524,7 +524,7 @@ struct Reader<'span, S: InternableSpan> {
524524
span_data_table: &'span S::Table,
525525
}
526526

527-
impl<'span, S: InternableSpan> Reader<'span, S> {
527+
impl<S: InternableSpan> Reader<'_, S> {
528528
pub(crate) fn read(self) -> tt::Subtree<S> {
529529
let mut res: Vec<Option<tt::Subtree<S>>> = vec![None; self.subtree.len()];
530530
let read_span = |id| S::span_for_token_id(self.span_data_table, id);

crates/ra-salsa/src/derived/slot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ Please report this bug to https://github.com/salsa-rs/salsa/issues."
616616
}
617617
}
618618

619-
impl<'me, Q> Drop for PanicGuard<'me, Q>
619+
impl<Q> Drop for PanicGuard<'_, Q>
620620
where
621621
Q: QueryFunction,
622622
Q::Value: Eq,

crates/ra-salsa/src/derived_lru/slot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ Please report this bug to https://github.com/salsa-rs/salsa/issues."
666666
}
667667
}
668668

669-
impl<'me, Q, MP> Drop for PanicGuard<'me, Q, MP>
669+
impl<Q, MP> Drop for PanicGuard<'_, Q, MP>
670670
where
671671
Q: QueryFunction,
672672
MP: MemoizationPolicy<Q>,

crates/ra-salsa/src/interned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ where
493493
is_static::<Slot<K>>();
494494
}
495495

496-
impl<'me, Q> QueryTable<'me, Q>
496+
impl<Q> QueryTable<'_, Q>
497497
where
498498
Q: Query<Storage = InternedStorage<Q>>,
499499
Q::Key: InternValue,

crates/ra-salsa/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ where
149149
db: &'me D,
150150
}
151151

152-
impl<'me, D: ?Sized> fmt::Debug for EventDebug<'me, D>
152+
impl<D: ?Sized> fmt::Debug for EventDebug<'_, D>
153153
where
154154
D: plumbing::DatabaseOps,
155155
{
@@ -242,7 +242,7 @@ where
242242
db: &'me D,
243243
}
244244

245-
impl<'me, D: ?Sized> fmt::Debug for EventKindDebug<'me, D>
245+
impl<D: ?Sized> fmt::Debug for EventKindDebug<'_, D>
246246
where
247247
D: plumbing::DatabaseOps,
248248
{
@@ -729,7 +729,7 @@ impl Cycle {
729729
db: &'me dyn Database,
730730
}
731731

732-
impl<'me> std::fmt::Debug for UnexpectedCycleDebug<'me> {
732+
impl std::fmt::Debug for UnexpectedCycleDebug<'_> {
733733
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
734734
fmt.debug_struct("UnexpectedCycle")
735735
.field("all_participants", &self.c.all_participants(self.db))

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,12 @@ pub(crate) fn handle_document_symbol(
489489
tags.push(SymbolTag::DEPRECATED)
490490
};
491491

492+
#[allow(deprecated)]
492493
let doc_symbol = lsp_types::DocumentSymbol {
493494
name: symbol.label,
494495
detail: symbol.detail,
495496
kind: to_proto::structure_node_kind(symbol.kind),
496497
tags: Some(tags),
497-
#[allow(deprecated)]
498498
deprecated: Some(symbol.deprecated),
499499
range: to_proto::range(&line_index, symbol.node_range),
500500
selection_range: to_proto::range(&line_index, symbol.navigation_range),
@@ -539,11 +539,11 @@ pub(crate) fn handle_document_symbol(
539539
url: &Url,
540540
res: &mut Vec<SymbolInformation>,
541541
) {
542+
#[allow(deprecated)]
542543
res.push(SymbolInformation {
543544
name: symbol.name.clone(),
544545
kind: symbol.kind,
545546
tags: symbol.tags.clone(),
546-
#[allow(deprecated)]
547547
deprecated: symbol.deprecated,
548548
location: Location::new(url.clone(), symbol.range),
549549
container_name,

crates/rust-analyzer/src/tracing/hprof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub struct DataVisitor<'a> {
120120
string: &'a mut String,
121121
}
122122

123-
impl<'a> Visit for DataVisitor<'a> {
123+
impl Visit for DataVisitor<'_> {
124124
fn record_debug(&mut self, field: &Field, value: &dyn std::fmt::Debug) {
125125
write!(self.string, "{} = {:?} ", field.name(), value).unwrap();
126126
}

crates/tt/src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub enum TokenTreeRef<'a, Span> {
134134
Leaf(&'a Leaf<Span>, &'a TokenTree<Span>),
135135
}
136136

137-
impl<'a, Span: Copy> TokenTreeRef<'a, Span> {
137+
impl<Span: Copy> TokenTreeRef<'_, Span> {
138138
pub fn span(&self) -> Span {
139139
match self {
140140
TokenTreeRef::Subtree(subtree, _) => subtree.delimiter.open,

0 commit comments

Comments
 (0)