Skip to content

Commit 10fe722

Browse files
committed
style: clean up some recent lint violations
It looks like `dead_code` got a little smarter, and more pervasively, some new lint that detects superfluous imports found a bunch of them.
1 parent d7f9347 commit 10fe722

File tree

14 files changed

+18
-72
lines changed

14 files changed

+18
-72
lines changed

regex-automata/src/dfa/dense.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This module also contains a [`dense::Builder`](Builder) and a
99

1010
#[cfg(feature = "dfa-build")]
1111
use core::cmp;
12-
use core::{convert::TryFrom, fmt, iter, mem::size_of, slice};
12+
use core::{fmt, iter, mem::size_of, slice};
1313

1414
#[cfg(feature = "dfa-build")]
1515
use alloc::{

regex-automata/src/dfa/sparse.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ assert_eq!(Some(HalfMatch::must(0, 7)), state.get_match());
3838

3939
#[cfg(feature = "dfa-build")]
4040
use core::iter;
41-
use core::{
42-
convert::{TryFrom, TryInto},
43-
fmt,
44-
mem::size_of,
45-
};
41+
use core::{fmt, mem::size_of};
4642

4743
#[cfg(feature = "dfa-build")]
4844
use alloc::{vec, vec::Vec};

regex-automata/src/nfa/thompson/compiler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,11 +1876,11 @@ impl Utf8Node {
18761876

18771877
#[cfg(test)]
18781878
mod tests {
1879-
use alloc::{vec, vec::Vec};
1879+
use alloc::vec;
18801880

18811881
use crate::{
1882-
nfa::thompson::{SparseTransitions, State, Transition, NFA},
1883-
util::primitives::{PatternID, SmallIndex, StateID},
1882+
nfa::thompson::{SparseTransitions, State},
1883+
util::primitives::SmallIndex,
18841884
};
18851885

18861886
use super::*;

regex-automata/src/nfa/thompson/range_trie.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ construction later by virtue of producing a much much smaller NFA.
141141
[2] - https://www.mitpressjournals.org/doi/pdfplus/10.1162/089120100561601
142142
*/
143143

144-
use core::{cell::RefCell, convert::TryFrom, fmt, mem, ops::RangeInclusive};
144+
use core::{cell::RefCell, fmt, mem, ops::RangeInclusive};
145145

146146
use alloc::{format, string::String, vec, vec::Vec};
147147

@@ -915,10 +915,6 @@ fn intersects(r1: Utf8Range, r2: Utf8Range) -> bool {
915915

916916
#[cfg(test)]
917917
mod tests {
918-
use core::ops::RangeInclusive;
919-
920-
use regex_syntax::utf8::Utf8Range;
921-
922918
use super::*;
923919

924920
fn r(range: RangeInclusive<u8>) -> Utf8Range {

regex-automata/src/util/determinize/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ serialized anywhere. So any kind of change can be made with reckless abandon,
8686
as long as everything in this module agrees.
8787
*/
8888

89-
use core::{convert::TryFrom, mem};
89+
use core::mem;
9090

9191
use alloc::{sync::Arc, vec::Vec};
9292

regex-automata/src/util/int.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ like `u64::from` where possible, or even `usize::try_from()` for when we do
4141
explicitly want to panic or when we want to return an error for overflow.
4242
*/
4343

44+
// We define a little more than what we need, but I'd rather just have
45+
// everything via a consistent and uniform API then have holes.
46+
#![allow(dead_code)]
47+
4448
pub(crate) trait U8 {
4549
fn as_usize(self) -> usize;
4650
}
@@ -240,13 +244,3 @@ impl<T> Pointer for *const T {
240244
self as usize
241245
}
242246
}
243-
244-
pub(crate) trait PointerMut {
245-
fn as_usize(self) -> usize;
246-
}
247-
248-
impl<T> PointerMut for *mut T {
249-
fn as_usize(self) -> usize {
250-
self as usize
251-
}
252-
}

regex-automata/src/util/wire.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ generally requires serializing both its big-endian and little-endian variants,
4141
and then loading the correct one based on the target's endianness.
4242
*/
4343

44-
use core::{
45-
cmp,
46-
convert::{TryFrom, TryInto},
47-
mem::size_of,
48-
};
44+
use core::{cmp, mem::size_of};
4945

5046
#[cfg(feature = "alloc")]
5147
use alloc::{vec, vec::Vec};
@@ -867,11 +863,6 @@ pub(crate) trait Endian {
867863
/// this panics.
868864
fn write_u32(n: u32, dst: &mut [u8]);
869865

870-
/// Writes a u64 to the given destination buffer in a particular
871-
/// endianness. If the destination buffer has a length smaller than 8, then
872-
/// this panics.
873-
fn write_u64(n: u64, dst: &mut [u8]);
874-
875866
/// Writes a u128 to the given destination buffer in a particular
876867
/// endianness. If the destination buffer has a length smaller than 16,
877868
/// then this panics.
@@ -897,10 +888,6 @@ impl Endian for LE {
897888
dst[..4].copy_from_slice(&n.to_le_bytes());
898889
}
899890

900-
fn write_u64(n: u64, dst: &mut [u8]) {
901-
dst[..8].copy_from_slice(&n.to_le_bytes());
902-
}
903-
904891
fn write_u128(n: u128, dst: &mut [u8]) {
905892
dst[..16].copy_from_slice(&n.to_le_bytes());
906893
}
@@ -915,10 +902,6 @@ impl Endian for BE {
915902
dst[..4].copy_from_slice(&n.to_be_bytes());
916903
}
917904

918-
fn write_u64(n: u64, dst: &mut [u8]) {
919-
dst[..8].copy_from_slice(&n.to_be_bytes());
920-
}
921-
922905
fn write_u128(n: u128, dst: &mut [u8]) {
923906
dst[..16].copy_from_slice(&n.to_be_bytes());
924907
}

regex-capi/src/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::fmt;
44
use std::str;
55

66
use libc::c_char;
7-
use regex;
87

98
#[derive(Debug)]
109
pub struct Error {
@@ -22,7 +21,7 @@ pub enum ErrorKind {
2221

2322
impl Error {
2423
pub fn new(kind: ErrorKind) -> Error {
25-
Error { message: None, kind: kind }
24+
Error { message: None, kind }
2625
}
2726

2827
pub fn is_err(&self) -> bool {

regex-cli/cmd/debug/dfa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
util::{self, Table},
66
};
77

8-
use {lexopt, regex_automata::dfa::Automaton};
8+
use regex_automata::dfa::Automaton;
99

1010
pub fn run_dense(p: &mut lexopt::Parser) -> anyhow::Result<()> {
1111
const USAGE: &'static str = "\

regex-cli/logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// print to stderr. We therefore avoid bringing in extra dependencies just
44
// for this functionality.
55

6-
use log::{self, Log};
6+
use log::Log;
77

88
/// The simplest possible logger that logs to stderr.
99
///

0 commit comments

Comments
 (0)