Update to Rust 1.85

Edition update to follow later
This commit is contained in:
Damien Elmes 2025-02-21 10:33:57 +07:00
parent 8e13e6bfc1
commit 2727cf39b2
16 changed files with 11 additions and 22 deletions

View file

@ -34,6 +34,5 @@ impl BackendCardRenderingService for Backend {
request.speed,
&request.text,
)
.map(Into::into)
}
}

View file

@ -77,7 +77,6 @@ impl crate::services::ConfigService for Collection {
) -> Result<()> {
let val: Value = serde_json::from_slice(&input.value_json)?;
self.transact_no_undo(|col| col.set_config(input.key.as_str(), &val).map(|_| ()))
.map(Into::into)
}
fn remove_config(

View file

@ -18,9 +18,7 @@ impl BackendImportExportService for Backend {
let mut guard = self.lock_open_collection()?;
let col_inner = guard.take().unwrap();
col_inner
.export_colpkg(input.out_path, input.include_media, input.legacy)
.map(Into::into)
col_inner.export_colpkg(input.out_path, input.include_media, input.legacy)
}
fn import_collection_package(
@ -36,6 +34,5 @@ impl BackendImportExportService for Backend {
Path::new(&input.media_db),
self.new_progress_handler(),
)
.map(Into::into)
}
}

View file

@ -99,7 +99,7 @@ impl TryFrom<anki_proto::sync::SyncAuth> for SyncAuth {
impl crate::services::BackendSyncService for Backend {
fn sync_media(&self, input: anki_proto::sync::SyncAuth) -> Result<()> {
let auth = input.try_into()?;
self.sync_media_in_background(auth, None).map(Into::into)
self.sync_media_in_background(auth, None)
}
fn media_sync_status(&self) -> Result<MediaSyncStatusResponse> {

View file

@ -131,7 +131,7 @@ impl From<Card> for anki_proto::cards::Card {
original_due: c.original_due,
original_deck_id: c.original_deck_id.0,
flags: c.flags as u32,
original_position: c.original_position.map(Into::into),
original_position: c.original_position,
memory_state: c.memory_state.map(Into::into),
desired_retention: c.desired_retention,
custom_data: c.custom_data,

View file

@ -21,7 +21,6 @@ impl crate::services::DeckConfigService for Collection {
col.add_or_update_deck_config_legacy(&mut conf)?;
Ok(anki_proto::deck_config::DeckConfigId { dcid: conf.id.0 })
})
.map(Into::into)
}
fn all_deck_config_legacy(&mut self) -> Result<generic::Json> {
@ -62,7 +61,6 @@ impl crate::services::DeckConfigService for Collection {
fn remove_deck_config(&mut self, input: anki_proto::deck_config::DeckConfigId) -> Result<()> {
self.transact_no_undo(|col| col.remove_deck_config_inner(input.into()))
.map(Into::into)
}
fn get_deck_configs_for_update(

View file

@ -55,7 +55,7 @@ impl crate::services::SchedulerService for Collection {
self.transact_no_undo(|col| {
let today = col.current_due_day(0)?;
let usn = col.usn()?;
col.update_deck_stats(today, usn, input).map(Into::into)
col.update_deck_stats(today, usn, input)
})
}
@ -70,7 +70,6 @@ impl crate::services::SchedulerService for Collection {
input.new_delta,
input.review_delta,
)
.map(Into::into)
})
}
@ -229,7 +228,6 @@ impl crate::services::SchedulerService for Collection {
fn upgrade_scheduler(&mut self) -> Result<()> {
self.transact_no_undo(|col| col.upgrade_to_v2_scheduler())
.map(Into::into)
}
fn get_queued_cards(

View file

@ -129,7 +129,7 @@ impl crate::services::SearchService for Collection {
&mut self,
input: generic::Int64,
) -> Result<anki_proto::search::BrowserRow> {
self.browser_row_for_id(input.val).map(Into::into)
self.browser_row_for_id(input.val)
}
}

View file

@ -34,7 +34,7 @@ impl crate::services::StatsService for Collection {
&mut self,
input: anki_proto::stats::GraphPreferences,
) -> error::Result<()> {
self.set_graph_preferences(input).map(Into::into)
self.set_graph_preferences(input)
}
}

View file

@ -82,7 +82,6 @@ impl SqliteStorage {
.query_and_then([machine_name], row_to_deck)?
.next()
.transpose()
.map_err(Into::into)
}
pub(crate) fn get_all_decks(&self) -> Result<Vec<Deck>> {

View file

@ -68,7 +68,6 @@ impl SqliteStorage {
.query_and_then([name], |row| Ok::<_, AnkiError>(DeckConfigId(row.get(0)?)))?
.next()
.transpose()
.map_err(Into::into)
}
pub(crate) fn add_deck_conf(&self, conf: &mut DeckConfig) -> Result<()> {

View file

@ -280,7 +280,7 @@ impl super::SqliteStorage {
include_str!("get.sql"),
" WHERE id IN (SELECT nid FROM search_nids)"
))?
.query_and_then([], |r| row_to_note(r).map_err(Into::into))?
.query_and_then([], row_to_note)?
.collect()
}

View file

@ -175,7 +175,7 @@ impl SqliteStorage {
pub(crate) fn get_all_revlog_entries(&self, after: TimestampSecs) -> Result<Vec<RevlogEntry>> {
self.db
.prepare_cached(concat!(include_str!("get.sql"), " where id >= ?"))?
.query_and_then([after.0 * 1000], |r| row_to_revlog_entry(r).map(Into::into))?
.query_and_then([after.0 * 1000], row_to_revlog_entry)?
.collect()
}

View file

@ -410,7 +410,7 @@ fn schema_version(db: &Connection) -> Result<(bool, u8)> {
Ok((
false,
db.query_row("select ver from col", [], |r| r.get(0).map_err(Into::into))?,
db.query_row("select ver from col", [], |r| r.get(0))?,
))
}

View file

@ -79,7 +79,7 @@ impl ServerMediaManager {
}
fn add_or_replace_file(path: &Path, data: Vec<u8>) -> error::Result<(), FileIoError> {
write_file(path, data).map_err(Into::into)
write_file(path, data)
}
fn remove_file(path: &Path) -> error::Result<(), FileIoError> {

View file

@ -1,3 +1,3 @@
[toolchain]
# older versions may fail to compile; newer versions may fail the clippy tests
channel = "1.84.0"
channel = "1.85.0"