Skip to content

Commit

Permalink
Upgrade to Rust 1.84.1
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgrinaker committed Feb 2, 2025
1 parent f979d3d commit 50aead6
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.77.0
- uses: dtolnay/rust-toolchain@1.84.1
id: toolchain
with:
components: clippy, rustfmt
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.84.1
10 changes: 5 additions & 5 deletions src/encoding/keycode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct Serializer {
output: Vec<u8>,
}

impl<'a> ser::Serializer for &'a mut Serializer {
impl ser::Serializer for &mut Serializer {
type Ok = ();
type Error = Error;

Expand Down Expand Up @@ -296,7 +296,7 @@ impl<'a> ser::Serializer for &'a mut Serializer {
}

/// Sequences simply concatenate the serialized elements, with no external structure.
impl<'a> ser::SerializeSeq for &'a mut Serializer {
impl ser::SerializeSeq for &mut Serializer {
type Ok = ();
type Error = Error;

Expand All @@ -310,7 +310,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer {
}

/// Tuples, like sequences, simply concatenate the serialized elements.
impl<'a> ser::SerializeTuple for &'a mut Serializer {
impl ser::SerializeTuple for &mut Serializer {
type Ok = ();
type Error = Error;

Expand All @@ -324,7 +324,7 @@ impl<'a> ser::SerializeTuple for &'a mut Serializer {
}

/// Tuples, like sequences, simply concatenate the serialized elements.
impl<'a> ser::SerializeTupleVariant for &'a mut Serializer {
impl ser::SerializeTupleVariant for &mut Serializer {
type Ok = ();
type Error = Error;

Expand Down Expand Up @@ -385,7 +385,7 @@ impl<'de> Deserializer<'de> {
}

/// For details on serialization formats, see Serializer.
impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
impl<'de> de::Deserializer<'de> for &mut Deserializer<'de> {
type Error = Error;

fn deserialize_any<V: de::Visitor<'de>>(self, _: V) -> Result<V::Value> {
Expand Down
2 changes: 1 addition & 1 deletion src/raft/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl<'a> Iterator<'a> {
}
}

impl<'a> std::iter::Iterator for Iterator<'a> {
impl std::iter::Iterator for Iterator<'_> {
type Item = Result<Entry>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
2 changes: 1 addition & 1 deletion src/sql/engine/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<E: storage::Engine> Local<E> {
}
}

impl<'a, E: storage::Engine> super::Engine<'a> for Local<E> {
impl<E: storage::Engine> super::Engine<'_> for Local<E> {
type Transaction = Transaction<E>;

fn begin(&self) -> Result<Self::Transaction> {
Expand Down
8 changes: 4 additions & 4 deletions src/sql/engine/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<'a> Transaction<'a> {
}
}

impl<'a> super::Transaction for Transaction<'a> {
impl super::Transaction for Transaction<'_> {
fn state(&self) -> &mvcc::TransactionState {
&self.state
}
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<'a> super::Transaction for Transaction<'a> {
}
}

impl<'a> Catalog for Transaction<'a> {
impl Catalog for Transaction<'_> {
fn create_table(&self, schema: Table) -> Result<()> {
self.engine.write(Write::CreateTable { txn: (&self.state).into(), schema })
}
Expand Down Expand Up @@ -371,7 +371,7 @@ pub enum Read<'a> {
},
}

impl<'a> encoding::Value for Read<'a> {}
impl encoding::Value for Read<'_> {}

/// A Raft engine write. Values correspond to engine method parameters. Uses
/// Cows to allow borrowed encoding (for borrowed params) and owned decoding.
Expand All @@ -389,7 +389,7 @@ pub enum Write<'a> {
DropTable { txn: Cow<'a, mvcc::TransactionState>, table: Cow<'a, str>, if_exists: bool },
}

impl<'a> encoding::Value for Write<'a> {}
impl encoding::Value for Write<'_> {}

/// Raft SQL engine status.
#[derive(Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/sql/engine/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'a, E: Engine<'a>> Session<'a, E> {
}
}

impl<'a> Session<'a, Raft> {
impl Session<'_, Raft> {
/// Returns Raft SQL engine status.
pub fn status(&self) -> Result<Status> {
self.engine.status()
Expand Down
2 changes: 1 addition & 1 deletion src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ mod tests {
}
}

impl<'a> goldenscript::Runner for SQLRunner<'a> {
impl goldenscript::Runner for SQLRunner<'_> {
fn run(&mut self, command: &goldenscript::Command) -> Result<String, Box<dyn Error>> {
let mut output = String::new();

Expand Down
2 changes: 1 addition & 1 deletion src/sql/parser/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ impl std::fmt::Display for Keyword {
}

/// The lexer is used as a token iterator.
impl<'a> Iterator for Lexer<'a> {
impl Iterator for Lexer<'_> {
type Item = Result<Token>;

fn next(&mut self) -> Option<Result<Token>> {
Expand Down
6 changes: 3 additions & 3 deletions src/sql/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Parser<'a> {
pub lexer: std::iter::Peekable<Lexer<'a>>,
}

impl<'a> Parser<'a> {
impl Parser<'_> {
/// Creates a new parser for the given raw SQL string.
pub fn new(statement: &str) -> Parser {
Parser { lexer: Lexer::new(statement).peekable() }
Expand Down Expand Up @@ -531,8 +531,8 @@ impl<'a> Parser<'a> {
Token::String(s) => ast::Literal::String(s).into(),
Token::Keyword(Keyword::True) => ast::Literal::Boolean(true).into(),
Token::Keyword(Keyword::False) => ast::Literal::Boolean(false).into(),
Token::Keyword(Keyword::Infinity) => ast::Literal::Float(std::f64::INFINITY).into(),
Token::Keyword(Keyword::NaN) => ast::Literal::Float(std::f64::NAN).into(),
Token::Keyword(Keyword::Infinity) => ast::Literal::Float(f64::INFINITY).into(),
Token::Keyword(Keyword::NaN) => ast::Literal::Float(f64::NAN).into(),
Token::Keyword(Keyword::Null) => ast::Literal::Null.into(),

// Function call.
Expand Down
6 changes: 3 additions & 3 deletions src/storage/bitcask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,22 @@ pub struct ScanIterator<'a> {
log: &'a mut Log,
}

impl<'a> ScanIterator<'a> {
impl ScanIterator<'_> {
fn map(&mut self, item: (&Vec<u8>, &(u64, u32))) -> <Self as Iterator>::Item {
let (key, (value_pos, value_len)) = item;
Ok((key.clone(), self.log.read_value(*value_pos, *value_len)?))
}
}

impl<'a> Iterator for ScanIterator<'a> {
impl Iterator for ScanIterator<'_> {
type Item = Result<(Vec<u8>, Vec<u8>)>;

fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(|item| self.map(item))
}
}

impl<'a> DoubleEndedIterator for ScanIterator<'a> {
impl DoubleEndedIterator for ScanIterator<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back().map(|item| self.map(item))
}
Expand Down
12 changes: 8 additions & 4 deletions src/storage/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ pub mod test {
}

impl<E: Engine> Engine for Emit<E> {
type ScanIterator<'a> = E::ScanIterator<'a> where E: 'a;
type ScanIterator<'a>
= E::ScanIterator<'a>
where
E: 'a;

fn flush(&mut self) -> Result<()> {
self.inner.flush()?;
Expand Down Expand Up @@ -303,7 +306,8 @@ pub mod test {
}

impl<A: Engine, B: Engine> Engine for Mirror<A, B> {
type ScanIterator<'a> = MirrorIterator<'a, A, B>
type ScanIterator<'a>
= MirrorIterator<'a, A, B>
where
Self: Sized,
A: 'a,
Expand Down Expand Up @@ -364,7 +368,7 @@ pub mod test {
b: B::ScanIterator<'a>,
}

impl<'a, A: Engine, B: Engine> Iterator for MirrorIterator<'a, A, B> {
impl<A: Engine, B: Engine> Iterator for MirrorIterator<'_, A, B> {
type Item = Result<(Vec<u8>, Vec<u8>)>;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -375,7 +379,7 @@ pub mod test {
}
}

impl<'a, A: Engine, B: Engine> DoubleEndedIterator for MirrorIterator<'a, A, B> {
impl<A: Engine, B: Engine> DoubleEndedIterator for MirrorIterator<'_, A, B> {
fn next_back(&mut self) -> Option<Self::Item> {
let a = self.a.next_back();
let b = self.b.next_back();
Expand Down
6 changes: 3 additions & 3 deletions src/storage/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ pub struct ScanIterator<'a> {
inner: std::collections::btree_map::Range<'a, Vec<u8>, Vec<u8>>,
}

impl<'a> ScanIterator<'a> {
impl ScanIterator<'_> {
fn map(item: (&Vec<u8>, &Vec<u8>)) -> <Self as Iterator>::Item {
let (key, value) = item;
Ok((key.clone(), value.clone()))
}
}

impl<'a> Iterator for ScanIterator<'a> {
impl Iterator for ScanIterator<'_> {
type Item = Result<(Vec<u8>, Vec<u8>)>;

fn next(&mut self) -> Option<Self::Item> {
self.inner.next().map(Self::map)
}
}

impl<'a> DoubleEndedIterator for ScanIterator<'a> {
impl DoubleEndedIterator for ScanIterator<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.next_back().map(Self::map)
}
Expand Down
4 changes: 2 additions & 2 deletions src/storage/mvcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl TransactionState {
/// that version commits its writes. See the module documentation for
/// details.
fn is_visible(&self, version: Version) -> bool {
if self.active.get(&version).is_some() {
if self.active.contains(&version) {
false
} else if self.read_only {
version < self.version
Expand Down Expand Up @@ -735,7 +735,7 @@ impl<'a, I: engine::ScanIterator> VersionIterator<'a, I> {
}
}

impl<'a, I: engine::ScanIterator> Iterator for VersionIterator<'a, I> {
impl<I: engine::ScanIterator> Iterator for VersionIterator<'_, I> {
type Item = Result<(Vec<u8>, Version, Vec<u8>)>;
fn next(&mut self) -> Option<Self::Item> {
self.try_next().transpose()
Expand Down

0 comments on commit 50aead6

Please sign in to comment.