Skip to content

Commit 7d146f6

Browse files
committed
Fix 1.74 clippy lints
1 parent 4db8ed0 commit 7d146f6

File tree

7 files changed

+17
-20
lines changed

7 files changed

+17
-20
lines changed

crates/cli/src/subcommands/repl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ impl Completer for ReplHelper {
144144
}
145145
name = name.chars().rev().collect();
146146

147-
let mut completions: Vec<_> = AUTO_COMPLETE.split('\n').map(str::to_string).collect();
148-
completions = completions
149-
.iter()
150-
.filter_map(|it| it.starts_with(&name).then(|| it.clone()))
147+
let completions: Vec<_> = AUTO_COMPLETE
148+
.split('\n')
149+
.filter(|it| it.starts_with(&name))
150+
.map(str::to_owned)
151151
.collect();
152152

153153
Ok((name_pos, completions))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
// TODO: change the triple-slash comments to normal comments in the .proto
2+
#![allow(clippy::four_forward_slashes)]
3+
14
include!(concat!(env!("OUT_DIR"), "/protobuf.rs"));

crates/core/src/db/datastore/locking_tx_datastore/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl TxState {
295295
}
296296

297297
pub fn get_or_create_delete_table(&mut self, table_id: TableId) -> &mut BTreeSet<RowId> {
298-
self.delete_tables.entry(table_id).or_insert_with(BTreeSet::new)
298+
self.delete_tables.entry(table_id).or_default()
299299
}
300300

301301
/// When there's an index on `cols`,

crates/core/src/sql/ast.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,13 @@ impl From {
176176
pub fn find_field(&self, f: &str) -> Result<Vec<FieldDef>, RelationError> {
177177
let field = extract_table_field(f)?;
178178
let fields = self.iter_tables().flat_map(|t| {
179-
t.columns.iter().filter_map(|column| {
180-
(column.col_name == field.field).then(|| FieldDef {
179+
t.columns
180+
.iter()
181+
.filter(|column| column.col_name == field.field)
182+
.map(|column| FieldDef {
181183
column: column.clone(),
182184
table_name: field.table.unwrap_or(&t.table_name).to_string(),
183185
})
184-
})
185186
});
186187

187188
Ok(fields.collect())

crates/data-structures/src/slim_slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ impl Ord for SlimStr<'_> {
14061406
impl PartialOrd for SlimStr<'_> {
14071407
#[inline]
14081408
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1409-
self.deref().partial_cmp(other.deref())
1409+
Some(self.cmp(other))
14101410
}
14111411
}
14121412
impl PartialOrd<str> for SlimStr<'_> {
@@ -1585,7 +1585,7 @@ impl Ord for SlimStrMut<'_> {
15851585
impl PartialOrd for SlimStrMut<'_> {
15861586
#[inline]
15871587
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
1588-
self.deref().partial_cmp(other.deref())
1588+
Some(self.cmp(other))
15891589
}
15901590
}
15911591
impl PartialOrd<str> for SlimStrMut<'_> {

crates/lib/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,8 @@ impl TableDef {
155155
}
156156

157157
// Multi-column indexes cannot be unique (yet), so just add them.
158-
let multi_col_indexes = table.indexes.iter().filter_map(|index| {
159-
(index.cols.len() > 1).then(|| {
160-
spacetimedb_sats::db::def::IndexDef::new_cols(
161-
index.name.clone(),
162-
AUTO_TABLE_ID,
163-
false,
164-
index.cols.clone(),
165-
)
166-
})
158+
let multi_col_indexes = table.indexes.iter().filter(|index| index.cols.len() > 1).map(|index| {
159+
spacetimedb_sats::db::def::IndexDef::new_cols(index.name.clone(), AUTO_TABLE_ID, false, index.cols.clone())
167160
});
168161
indexes.extend(multi_col_indexes);
169162

crates/sats/src/typespace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl IndexMut<AlgebraicTypeRef> for Typespace {
4949
}
5050

5151
impl Typespace {
52-
pub const EMPTY: &Typespace = &Self::new(Vec::new());
52+
pub const EMPTY: &'static Typespace = &Self::new(Vec::new());
5353

5454
/// Returns a context ([`Typespace`]) with the given `types`.
5555
pub const fn new(types: Vec<AlgebraicType>) -> Self {

0 commit comments

Comments
 (0)