mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
Update to rust 1.74 (#589)
* Update to rust 1.74 * Fix 1.74 clippy lints
This commit is contained in:
@@ -144,10 +144,10 @@ impl Completer for ReplHelper {
|
||||
}
|
||||
name = name.chars().rev().collect();
|
||||
|
||||
let mut completions: Vec<_> = AUTO_COMPLETE.split('\n').map(str::to_string).collect();
|
||||
completions = completions
|
||||
.iter()
|
||||
.filter_map(|it| it.starts_with(&name).then(|| it.clone()))
|
||||
let completions: Vec<_> = AUTO_COMPLETE
|
||||
.split('\n')
|
||||
.filter(|it| it.starts_with(&name))
|
||||
.map(str::to_owned)
|
||||
.collect();
|
||||
|
||||
Ok((name_pos, completions))
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
// TODO: change the triple-slash comments to normal comments in the .proto
|
||||
#![allow(clippy::four_forward_slashes)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/protobuf.rs"));
|
||||
|
||||
@@ -299,7 +299,7 @@ impl TxState {
|
||||
}
|
||||
|
||||
pub fn get_or_create_delete_table(&mut self, table_id: TableId) -> &mut BTreeSet<RowId> {
|
||||
self.delete_tables.entry(table_id).or_insert_with(BTreeSet::new)
|
||||
self.delete_tables.entry(table_id).or_default()
|
||||
}
|
||||
|
||||
/// When there's an index on `cols`,
|
||||
|
||||
@@ -176,12 +176,13 @@ impl From {
|
||||
pub fn find_field(&self, f: &str) -> Result<Vec<FieldDef>, RelationError> {
|
||||
let field = extract_table_field(f)?;
|
||||
let fields = self.iter_tables().flat_map(|t| {
|
||||
t.columns.iter().filter_map(|column| {
|
||||
(column.col_name == field.field).then(|| FieldDef {
|
||||
t.columns
|
||||
.iter()
|
||||
.filter(|column| column.col_name == field.field)
|
||||
.map(|column| FieldDef {
|
||||
column: column.clone(),
|
||||
table_name: field.table.unwrap_or(&t.table_name).to_string(),
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
Ok(fields.collect())
|
||||
|
||||
@@ -1406,7 +1406,7 @@ impl Ord for SlimStr<'_> {
|
||||
impl PartialOrd for SlimStr<'_> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
self.deref().partial_cmp(other.deref())
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
impl PartialOrd<str> for SlimStr<'_> {
|
||||
@@ -1585,7 +1585,7 @@ impl Ord for SlimStrMut<'_> {
|
||||
impl PartialOrd for SlimStrMut<'_> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
self.deref().partial_cmp(other.deref())
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
impl PartialOrd<str> for SlimStrMut<'_> {
|
||||
|
||||
@@ -155,15 +155,8 @@ impl TableDef {
|
||||
}
|
||||
|
||||
// Multi-column indexes cannot be unique (yet), so just add them.
|
||||
let multi_col_indexes = table.indexes.iter().filter_map(|index| {
|
||||
(index.cols.len() > 1).then(|| {
|
||||
spacetimedb_sats::db::def::IndexDef::new_cols(
|
||||
index.name.clone(),
|
||||
AUTO_TABLE_ID,
|
||||
false,
|
||||
index.cols.clone(),
|
||||
)
|
||||
})
|
||||
let multi_col_indexes = table.indexes.iter().filter(|index| index.cols.len() > 1).map(|index| {
|
||||
spacetimedb_sats::db::def::IndexDef::new_cols(index.name.clone(), AUTO_TABLE_ID, false, index.cols.clone())
|
||||
});
|
||||
indexes.extend(multi_col_indexes);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ impl IndexMut<AlgebraicTypeRef> for Typespace {
|
||||
}
|
||||
|
||||
impl Typespace {
|
||||
pub const EMPTY: &Typespace = &Self::new(Vec::new());
|
||||
pub const EMPTY: &'static Typespace = &Self::new(Vec::new());
|
||||
|
||||
/// Returns a context ([`Typespace`]) with the given `types`.
|
||||
pub const fn new(types: Vec<AlgebraicType>) -> Self {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
ARG CARGO_PROFILE=release
|
||||
|
||||
|
||||
FROM rust:1.72.0 AS chef
|
||||
FROM rust:1.74.0 AS chef
|
||||
RUN rust_target=$(rustc -vV | awk '/^host:/{ print $2 }') && \
|
||||
curl https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$rust_target.tgz -fL | tar xz -C $CARGO_HOME/bin
|
||||
RUN cargo binstall -y cargo-chef@0.1.56
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
[toolchain]
|
||||
channel = "1.72.0"
|
||||
# change crates/standalone/Dockerfile too!
|
||||
channel = "1.74.0"
|
||||
profile = "default"
|
||||
targets = ["wasm32-unknown-unknown"]
|
||||
|
||||
Reference in New Issue
Block a user