Skip to content

Commit

Permalink
remove unused fields to fix compiler warnings
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aswild committed Feb 21, 2022
1 parent e03e4c1 commit 41d69da
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
12 changes: 2 additions & 10 deletions crates/ignore/src/types.rs
Expand Up @@ -122,10 +122,6 @@ enum GlobInner<'a> {
Matched {
/// The file type definition which provided the glob.
def: &'a FileTypeDef,
/// The index of the glob that matched inside the file type definition.
which: usize,
/// Whether the selection was negated or not.
negated: bool,
},
}

Expand Down Expand Up @@ -291,13 +287,9 @@ impl Types {
self.set.matches_into(name, &mut *matches);
// The highest precedent match is the last one.
if let Some(&i) = matches.last() {
let (isel, iglob) = self.glob_to_selection[i];
let (isel, _) = self.glob_to_selection[i];
let sel = &self.selections[isel];
let glob = Glob(GlobInner::Matched {
def: sel.inner(),
which: iglob,
negated: sel.is_negated(),
});
let glob = Glob(GlobInner::Matched { def: sel.inner() });
return if sel.is_negated() {
Match::Ignore(glob)
} else {
Expand Down
3 changes: 0 additions & 3 deletions crates/searcher/src/searcher/core.rs
Expand Up @@ -467,7 +467,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
let keepgoing = self.sink.context(
&self.searcher,
&SinkContext {
line_term: self.config.line_term,
bytes: &buf[*range],
kind: SinkContextKind::Before,
absolute_byte_offset: offset,
Expand Down Expand Up @@ -497,7 +496,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
let keepgoing = self.sink.context(
&self.searcher,
&SinkContext {
line_term: self.config.line_term,
bytes: &buf[*range],
kind: SinkContextKind::After,
absolute_byte_offset: offset,
Expand Down Expand Up @@ -526,7 +524,6 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> {
let keepgoing = self.sink.context(
&self.searcher,
&SinkContext {
line_term: self.config.line_term,
bytes: &buf[*range],
kind: SinkContextKind::Other,
absolute_byte_offset: offset,
Expand Down
2 changes: 0 additions & 2 deletions crates/searcher/src/searcher/glue.rs
Expand Up @@ -88,7 +88,6 @@ where

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

SliceByLine {
config: &searcher.config,
core: Core::new(searcher, matcher, write_to, true),
slice: slice,
}
Expand Down
1 change: 0 additions & 1 deletion crates/searcher/src/sink.rs
Expand Up @@ -436,7 +436,6 @@ pub enum SinkContextKind {
/// A type that describes a contextual line reported by a searcher.
#[derive(Clone, Debug)]
pub struct SinkContext<'b> {
pub(crate) line_term: LineTerminator,
pub(crate) bytes: &'b [u8],
pub(crate) kind: SinkContextKind,
pub(crate) absolute_byte_offset: u64,
Expand Down

0 comments on commit 41d69da

Please sign in to comment.