Skip to content

Commit 5c41c3e

Browse files
authored
chore: update Rust version to 1.86 and remove unused as_any methods… (#597)
chore: update Rust version to 1.86 and remove unused `as_any` methods from various implementations
1 parent c84fc47 commit 5c41c3e

File tree

10 files changed

+10
-43
lines changed

10 files changed

+10
-43
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name = "cocoindex"
44
# Will be overridden for specific release versions.
55
version = "999.0.0"
66
edition = "2024"
7+
rust-version = "1.86"
78

89
[profile.release]
910
codegen-units = 1

src/execution/db_tracking_setup.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ impl ResourceSetupStatus for TrackingTableSetupStatus {
155155
}
156156
}
157157

158-
fn as_any(&self) -> &dyn Any {
159-
self as &dyn Any
160-
}
158+
161159
}
162160

163161
impl TrackingTableSetupStatus {

src/ops/factory_bases.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,7 @@ impl<T: StorageFactoryBase> ExportTargetFactory for T {
504504
.map(|item| -> anyhow::Result<_> {
505505
Ok(TypedResourceSetupChangeItem {
506506
key: serde_json::from_value(item.key.clone())?,
507-
setup_status: item
508-
.setup_status
509-
.as_any()
507+
setup_status: (item.setup_status as &dyn Any)
510508
.downcast_ref::<T::SetupStatus>()
511509
.ok_or_else(invariance_violation)?,
512510
})

src/ops/storages/kuzu.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ impl setup::ResourceSetupStatus for GraphElementDataSetupStatus {
195195
self.actions.change_type(false)
196196
}
197197

198-
fn as_any(&self) -> &dyn Any {
199-
self
200-
}
198+
201199
}
202200

203201
fn append_drop_table(

src/ops/storages/neo4j.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,7 @@ impl ResourceSetupStatus for GraphElementDataSetupStatus {
854854
self.change_type
855855
}
856856

857-
fn as_any(&self) -> &dyn Any {
858-
self
859-
}
857+
860858
}
861859

862860
async fn clear_graph_element_data(

src/ops/storages/postgres.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,7 @@ impl setup::ResourceSetupStatus for SetupStatus {
526526
self.actions.table_action.change_type(has_other_update)
527527
}
528528

529-
fn as_any(&self) -> &dyn Any {
530-
self
531-
}
529+
532530
}
533531

534532
impl SetupStatus {

src/ops/storages/qdrant.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ impl setup::ResourceSetupStatus for SetupStatus {
142142
}
143143
}
144144

145-
fn as_any(&self) -> &dyn Any {
146-
self
147-
}
145+
148146
}
149147

150148
impl SetupStatus {

src/setup/components.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ impl<D: SetupOperator + Send + Sync> ResourceSetupStatus for SetupStatus<D> {
143143
SetupChangeType::Update
144144
}
145145
}
146-
147-
fn as_any(&self) -> &dyn Any {
148-
self
149-
}
150146
}
151147

152148
pub async fn apply_component_changes<D: SetupOperator>(
@@ -191,8 +187,4 @@ impl<A: ResourceSetupStatus, B: ResourceSetupStatus> ResourceSetupStatus for (A,
191187
(a, _) => a,
192188
}
193189
}
194-
195-
fn as_any(&self) -> &dyn Any {
196-
self
197-
}
198190
}

src/setup/db_metadata.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,7 @@ impl ResourceSetupStatus for MetadataTableSetup {
349349
}
350350
}
351351

352-
fn as_any(&self) -> &dyn Any {
353-
self as &dyn Any
354-
}
352+
355353
}
356354

357355
impl MetadataTableSetup {

src/setup/states.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::prelude::*;
1515

1616
use indenter::indented;
1717
use owo_colors::{AnsiColors, OwoColorize};
18+
use std::any::Any;
1819
use std::fmt::Debug;
1920
use std::fmt::{Display, Write};
2021
use std::hash::Hash;
@@ -218,15 +219,10 @@ pub enum SetupChangeType {
218219
Invalid,
219220
}
220221

221-
pub trait ResourceSetupStatus: Send + Sync + Debug + 'static {
222+
pub trait ResourceSetupStatus: Send + Sync + Debug + Any + 'static {
222223
fn describe_changes(&self) -> Vec<String>;
223224

224225
fn change_type(&self) -> SetupChangeType;
225-
226-
// Workaround as Rust doesn't support dyn upcasting before 1.86.
227-
// (https://github.com/rust-lang/rust/issues/65991)
228-
// Can be replaced by a `Any` bound when we require Rust 1.86 or newer.
229-
fn as_any(&self) -> &dyn Any;
230226
}
231227

232228
impl ResourceSetupStatus for Box<dyn ResourceSetupStatus> {
@@ -237,10 +233,6 @@ impl ResourceSetupStatus for Box<dyn ResourceSetupStatus> {
237233
fn change_type(&self) -> SetupChangeType {
238234
self.as_ref().change_type()
239235
}
240-
241-
fn as_any(&self) -> &dyn Any {
242-
self as &dyn Any
243-
}
244236
}
245237

246238
impl ResourceSetupStatus for std::convert::Infallible {
@@ -251,10 +243,6 @@ impl ResourceSetupStatus for std::convert::Infallible {
251243
fn change_type(&self) -> SetupChangeType {
252244
unreachable!()
253245
}
254-
255-
fn as_any(&self) -> &dyn Any {
256-
self as &dyn Any
257-
}
258246
}
259247

260248
#[derive(Debug)]

0 commit comments

Comments
 (0)