mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Update to Rust 1.85
Edition update to follow later
This commit is contained in:
parent
8e13e6bfc1
commit
2727cf39b2
16 changed files with 11 additions and 22 deletions
|
@ -34,6 +34,5 @@ impl BackendCardRenderingService for Backend {
|
||||||
request.speed,
|
request.speed,
|
||||||
&request.text,
|
&request.text,
|
||||||
)
|
)
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ impl crate::services::ConfigService for Collection {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let val: Value = serde_json::from_slice(&input.value_json)?;
|
let val: Value = serde_json::from_slice(&input.value_json)?;
|
||||||
self.transact_no_undo(|col| col.set_config(input.key.as_str(), &val).map(|_| ()))
|
self.transact_no_undo(|col| col.set_config(input.key.as_str(), &val).map(|_| ()))
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_config(
|
fn remove_config(
|
||||||
|
|
|
@ -18,9 +18,7 @@ impl BackendImportExportService for Backend {
|
||||||
let mut guard = self.lock_open_collection()?;
|
let mut guard = self.lock_open_collection()?;
|
||||||
|
|
||||||
let col_inner = guard.take().unwrap();
|
let col_inner = guard.take().unwrap();
|
||||||
col_inner
|
col_inner.export_colpkg(input.out_path, input.include_media, input.legacy)
|
||||||
.export_colpkg(input.out_path, input.include_media, input.legacy)
|
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn import_collection_package(
|
fn import_collection_package(
|
||||||
|
@ -36,6 +34,5 @@ impl BackendImportExportService for Backend {
|
||||||
Path::new(&input.media_db),
|
Path::new(&input.media_db),
|
||||||
self.new_progress_handler(),
|
self.new_progress_handler(),
|
||||||
)
|
)
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ impl TryFrom<anki_proto::sync::SyncAuth> for SyncAuth {
|
||||||
impl crate::services::BackendSyncService for Backend {
|
impl crate::services::BackendSyncService for Backend {
|
||||||
fn sync_media(&self, input: anki_proto::sync::SyncAuth) -> Result<()> {
|
fn sync_media(&self, input: anki_proto::sync::SyncAuth) -> Result<()> {
|
||||||
let auth = input.try_into()?;
|
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> {
|
fn media_sync_status(&self) -> Result<MediaSyncStatusResponse> {
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl From<Card> for anki_proto::cards::Card {
|
||||||
original_due: c.original_due,
|
original_due: c.original_due,
|
||||||
original_deck_id: c.original_deck_id.0,
|
original_deck_id: c.original_deck_id.0,
|
||||||
flags: c.flags as u32,
|
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),
|
memory_state: c.memory_state.map(Into::into),
|
||||||
desired_retention: c.desired_retention,
|
desired_retention: c.desired_retention,
|
||||||
custom_data: c.custom_data,
|
custom_data: c.custom_data,
|
||||||
|
|
|
@ -21,7 +21,6 @@ impl crate::services::DeckConfigService for Collection {
|
||||||
col.add_or_update_deck_config_legacy(&mut conf)?;
|
col.add_or_update_deck_config_legacy(&mut conf)?;
|
||||||
Ok(anki_proto::deck_config::DeckConfigId { dcid: conf.id.0 })
|
Ok(anki_proto::deck_config::DeckConfigId { dcid: conf.id.0 })
|
||||||
})
|
})
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn all_deck_config_legacy(&mut self) -> Result<generic::Json> {
|
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<()> {
|
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()))
|
self.transact_no_undo(|col| col.remove_deck_config_inner(input.into()))
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_deck_configs_for_update(
|
fn get_deck_configs_for_update(
|
||||||
|
|
|
@ -55,7 +55,7 @@ impl crate::services::SchedulerService for Collection {
|
||||||
self.transact_no_undo(|col| {
|
self.transact_no_undo(|col| {
|
||||||
let today = col.current_due_day(0)?;
|
let today = col.current_due_day(0)?;
|
||||||
let usn = col.usn()?;
|
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.new_delta,
|
||||||
input.review_delta,
|
input.review_delta,
|
||||||
)
|
)
|
||||||
.map(Into::into)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +228,6 @@ impl crate::services::SchedulerService for Collection {
|
||||||
|
|
||||||
fn upgrade_scheduler(&mut self) -> Result<()> {
|
fn upgrade_scheduler(&mut self) -> Result<()> {
|
||||||
self.transact_no_undo(|col| col.upgrade_to_v2_scheduler())
|
self.transact_no_undo(|col| col.upgrade_to_v2_scheduler())
|
||||||
.map(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_queued_cards(
|
fn get_queued_cards(
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl crate::services::SearchService for Collection {
|
||||||
&mut self,
|
&mut self,
|
||||||
input: generic::Int64,
|
input: generic::Int64,
|
||||||
) -> Result<anki_proto::search::BrowserRow> {
|
) -> Result<anki_proto::search::BrowserRow> {
|
||||||
self.browser_row_for_id(input.val).map(Into::into)
|
self.browser_row_for_id(input.val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl crate::services::StatsService for Collection {
|
||||||
&mut self,
|
&mut self,
|
||||||
input: anki_proto::stats::GraphPreferences,
|
input: anki_proto::stats::GraphPreferences,
|
||||||
) -> error::Result<()> {
|
) -> error::Result<()> {
|
||||||
self.set_graph_preferences(input).map(Into::into)
|
self.set_graph_preferences(input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@ impl SqliteStorage {
|
||||||
.query_and_then([machine_name], row_to_deck)?
|
.query_and_then([machine_name], row_to_deck)?
|
||||||
.next()
|
.next()
|
||||||
.transpose()
|
.transpose()
|
||||||
.map_err(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_all_decks(&self) -> Result<Vec<Deck>> {
|
pub(crate) fn get_all_decks(&self) -> Result<Vec<Deck>> {
|
||||||
|
|
|
@ -68,7 +68,6 @@ impl SqliteStorage {
|
||||||
.query_and_then([name], |row| Ok::<_, AnkiError>(DeckConfigId(row.get(0)?)))?
|
.query_and_then([name], |row| Ok::<_, AnkiError>(DeckConfigId(row.get(0)?)))?
|
||||||
.next()
|
.next()
|
||||||
.transpose()
|
.transpose()
|
||||||
.map_err(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn add_deck_conf(&self, conf: &mut DeckConfig) -> Result<()> {
|
pub(crate) fn add_deck_conf(&self, conf: &mut DeckConfig) -> Result<()> {
|
||||||
|
|
|
@ -280,7 +280,7 @@ impl super::SqliteStorage {
|
||||||
include_str!("get.sql"),
|
include_str!("get.sql"),
|
||||||
" WHERE id IN (SELECT nid FROM search_nids)"
|
" 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()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ impl SqliteStorage {
|
||||||
pub(crate) fn get_all_revlog_entries(&self, after: TimestampSecs) -> Result<Vec<RevlogEntry>> {
|
pub(crate) fn get_all_revlog_entries(&self, after: TimestampSecs) -> Result<Vec<RevlogEntry>> {
|
||||||
self.db
|
self.db
|
||||||
.prepare_cached(concat!(include_str!("get.sql"), " where id >= ?"))?
|
.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()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ fn schema_version(db: &Connection) -> Result<(bool, u8)> {
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
false,
|
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))?,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl ServerMediaManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_or_replace_file(path: &Path, data: Vec<u8>) -> error::Result<(), FileIoError> {
|
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> {
|
fn remove_file(path: &Path) -> error::Result<(), FileIoError> {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
# older versions may fail to compile; newer versions may fail the clippy tests
|
# older versions may fail to compile; newer versions may fail the clippy tests
|
||||||
channel = "1.84.0"
|
channel = "1.85.0"
|
||||||
|
|
Loading…
Reference in a new issue