Skip to content

Commit 69ccdf5

Browse files
committed
Fix new dead_code instances in rust-analyzer
1 parent 5fa77ad commit 69ccdf5

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,12 @@ pub enum FormatArgumentKind {
160160

161161
// Only used in parse_args and report_invalid_references,
162162
// to indicate how a referred argument was used.
163-
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
163+
#[derive(Clone, Copy, Debug)]
164164
enum PositionUsedAs {
165-
Placeholder(Option<TextRange>),
165+
Placeholder(
166+
// FIXME(#143487): is it okay that the field is never read?
167+
#[allow(dead_code)] Option<TextRange>,
168+
),
166169
Precision,
167170
Width,
168171
}

src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pub(crate) enum PatKind {
6666
/// `Foo(...)` or `Foo{...}` or `Foo`, where `Foo` is a variant name from an ADT with
6767
/// multiple variants.
6868
Variant {
69+
// FIXME(#143487): is it okay that the field is never read?
70+
#[allow(dead_code)]
6971
substs: Substitution,
7072
enum_variant: EnumVariantId,
7173
subpatterns: Vec<FieldPat>,

src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ enum PointerKind {
362362
// slice
363363
Length,
364364
OfAlias,
365-
OfParam(PlaceholderIndex),
365+
OfParam(
366+
// FIXME(#143487): is it okay that the field is never read?
367+
#[allow(dead_code)] PlaceholderIndex,
368+
),
366369
Error,
367370
}
368371

src/tools/rust-analyzer/crates/hir/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4632,9 +4632,11 @@ impl Closure {
46324632
}
46334633
}
46344634

4635-
#[derive(Clone, Debug, PartialEq, Eq)]
4635+
#[derive(Clone, Debug)]
46364636
pub struct ClosureCapture {
46374637
owner: DefWithBodyId,
4638+
// FIXME(#143487): is it okay that the field is never read?
4639+
#[allow(dead_code)]
46384640
closure: ClosureId,
46394641
capture: hir_ty::CapturedItem,
46404642
}

src/tools/rust-analyzer/crates/ide-completion/src/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ pub(crate) struct PatternContext {
287287
#[derive(Debug, Clone, PartialEq, Eq)]
288288
pub(crate) struct ParamContext {
289289
pub(crate) param_list: ast::ParamList,
290+
#[allow(dead_code, reason = "Used for equality comparison")]
290291
pub(crate) param: ast::Param,
291292
pub(crate) kind: ParamKind,
292293
}

src/tools/rust-analyzer/xtask/src/publish/notes.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,15 @@ impl Default for ListNesting {
421421

422422
#[derive(Debug, PartialEq, Eq)]
423423
enum ListMarker {
424-
Asterisk(usize),
424+
Asterisk(
425+
// FIXME(#143487): is it okay that the field is never read?
426+
#[allow(dead_code)] usize,
427+
),
425428
Hyphen,
426-
Dot(usize),
429+
Dot(
430+
// FIXME(#143487): is it okay that the field is never read?
431+
#[allow(dead_code)] usize,
432+
),
427433
}
428434

429435
impl ListMarker {

0 commit comments

Comments
 (0)