Skip to content

Commit 41d69da

Browse files
committed
remove unused fields to fix compiler warnings
This code hasn't changed, but the warnings are new in Rust 1.57 because of "ignore derived Clone and Debug implementations during dead code analysis"[1]. Rust now doesn't count its generated derive code as a use of these fields, revealing that they're not actually needed. Sure enough, removing them compiles successfully and passes tests. [1] rust-lang/rust#85200
1 parent e03e4c1 commit 41d69da

File tree

4 files changed

+2
-16
lines changed

4 files changed

+2
-16
lines changed

crates/ignore/src/types.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ enum GlobInner<'a> {
122122
Matched {
123123
/// The file type definition which provided the glob.
124124
def: &'a FileTypeDef,
125-
/// The index of the glob that matched inside the file type definition.
126-
which: usize,
127-
/// Whether the selection was negated or not.
128-
negated: bool,
129125
},
130126
}
131127

@@ -291,13 +287,9 @@ impl Types {
291287
self.set.matches_into(name, &mut *matches);
292288
// The highest precedent match is the last one.
293289
if let Some(&i) = matches.last() {
294-
let (isel, iglob) = self.glob_to_selection[i];
290+
let (isel, _) = self.glob_to_selection[i];
295291
let sel = &self.selections[isel];
296-
let glob = Glob(GlobInner::Matched {
297-
def: sel.inner(),
298-
which: iglob,
299-
negated: sel.is_negated(),
300-
});
292+
let glob = Glob(GlobInner::Matched { def: sel.inner() });
301293
return if sel.is_negated() {
302294
Match::Ignore(glob)
303295
} else {

crates/searcher/src/searcher/core.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
467467
let keepgoing = self.sink.context(
468468
&self.searcher,
469469
&SinkContext {
470-
line_term: self.config.line_term,
471470
bytes: &buf[*range],
472471
kind: SinkContextKind::Before,
473472
absolute_byte_offset: offset,
@@ -497,7 +496,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
497496
let keepgoing = self.sink.context(
498497
&self.searcher,
499498
&SinkContext {
500-
line_term: self.config.line_term,
501499
bytes: &buf[*range],
502500
kind: SinkContextKind::After,
503501
absolute_byte_offset: offset,
@@ -526,7 +524,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
526524
let keepgoing = self.sink.context(
527525
&self.searcher,
528526
&SinkContext {
529-
line_term: self.config.line_term,
530527
bytes: &buf[*range],
531528
kind: SinkContextKind::Other,
532529
absolute_byte_offset: offset,

crates/searcher/src/searcher/glue.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ where
8888

8989
#[derive(Debug)]
9090
pub struct SliceByLine<'s, M, S> {
91-
config: &'s Config,
9291
core: Core<'s, M, S>,
9392
slice: &'s [u8],
9493
}
@@ -103,7 +102,6 @@ impl<'s, M: Matcher, S: Sink> SliceByLine<'s, M, S> {
103102
debug_assert!(!searcher.multi_line_with_matcher(&matcher));
104103

105104
SliceByLine {
106-
config: &searcher.config,
107105
core: Core::new(searcher, matcher, write_to, true),
108106
slice: slice,
109107
}

crates/searcher/src/sink.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ pub enum SinkContextKind {
436436
/// A type that describes a contextual line reported by a searcher.
437437
#[derive(Clone, Debug)]
438438
pub struct SinkContext<'b> {
439-
pub(crate) line_term: LineTerminator,
440439
pub(crate) bytes: &'b [u8],
441440
pub(crate) kind: SinkContextKind,
442441
pub(crate) absolute_byte_offset: u64,

0 commit comments

Comments
 (0)