Skip to content

Commit c8e9314

Browse files
committed
Remove downcasting helper
1 parent 2214822 commit c8e9314

File tree

20 files changed

+0
-72
lines changed

20 files changed

+0
-72
lines changed

CHANGELOG.md

-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ and this project adheres to
1717
`Uint64::from_{be,le}_bytes`. ([#2269])
1818
- cosmwasm-std: Added new `Ibc2Msg` and `CosmosMsg::Ibc2` variant ([#2340],
1919
[#2390], [#2403])
20-
- cosmwasm-std: Implement downcasting for `Api` trait. This allows using
21-
`MockApi::addr_make` from `DepsMut`. ([#2457])
2220
- cosmwasm-std: Added `ibc2_port` to `ContractInfoResponse`. ([#2390], [#2403])
2321
- cosmwasm-vm: Added `ibc2_packet_receive` entrypoint ([#2403])
2422
- cosmwasm-vm: Add IBC Callbacks entrypoints to the `Entrypoints` enum.
@@ -99,7 +97,6 @@ and this project adheres to
9997
[#2432]: https://github.com/CosmWasm/cosmwasm/pull/2432
10098
[#2433]: https://github.com/CosmWasm/cosmwasm/pull/2433
10199
[#2438]: https://github.com/CosmWasm/cosmwasm/pull/2438
102-
[#2457]: https://github.com/CosmWasm/cosmwasm/issues/2457
103100

104101
## [2.2.0] - 2024-12-17
105102

Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/burner/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/crypto-verify/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/cyberpunk/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/empty/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/floaty/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/hackatom/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc-callbacks/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc-reflect-send/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc-reflect/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/ibc2/Cargo.lock

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/queue/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/reflect/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/replier/Cargo.lock

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/staking/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contracts/virus/Cargo.lock

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/std/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ serde_json = "1.0.140"
6969
static_assertions = "1.1.0"
7070
thiserror = "1.0.26"
7171
rmp-serde = "1.3.0"
72-
rustversion = "1.0"
7372

7473
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
7574
bech32 = "0.11.0"

packages/std/src/testing/mock.rs

-12
Original file line numberDiff line numberDiff line change
@@ -2715,16 +2715,4 @@ mod tests {
27152715
// we are not interested in the exact humanization, just that it works
27162716
mock_api.addr_humanize(&canonical_addr).unwrap();
27172717
}
2718-
2719-
#[rustversion::since(1.86)]
2720-
#[test]
2721-
fn mock_api_downcast() {
2722-
let mut deps = mock_dependencies();
2723-
let deps_mut = deps.as_mut();
2724-
2725-
let mock_api = deps_mut.api.cast_to_mockapi().unwrap();
2726-
2727-
let addr = mock_api.addr_make("input");
2728-
assert_eq!(mock_api.addr_validate(addr.as_str()).unwrap(), addr);
2729-
}
27302718
}

packages/std/src/traits.rs

-28
Original file line numberDiff line numberDiff line change
@@ -329,34 +329,6 @@ pub trait Api: Any {
329329
fn debug(&self, message: &str);
330330
}
331331

332-
#[rustversion::since(1.86)]
333-
impl dyn Api {
334-
/// Casts the Api trait object to the underlying [`MockApi`] type.
335-
/// Returns `None` if the underlying type is not a [`MockApi`].
336-
/// This function is only available since Rust 1.86.0.
337-
///
338-
/// This is useful in places where you only have access to `Deps` or `DepsMut` during testing,
339-
/// but need to use features from the [`MockApi`]:
340-
///
341-
/// ```rust
342-
/// use cosmwasm_std::{testing::mock_dependencies, Addr, Deps, Api};
343-
///
344-
/// fn admin_address(deps: Deps) -> Addr {
345-
/// let mock_api = deps.api.cast_to_mockapi().unwrap();
346-
/// mock_api.addr_make("admin")
347-
/// }
348-
///
349-
/// let mut deps = mock_dependencies();
350-
/// let addr = admin_address(deps.as_ref());
351-
/// assert_eq!(deps.api.addr_validate(addr.as_str()).unwrap(), addr);
352-
/// ```
353-
///
354-
/// [`MockApi`]: crate::testing::MockApi
355-
pub fn cast_to_mockapi(&self) -> Option<&crate::testing::MockApi> {
356-
(self as &dyn Any).downcast_ref()
357-
}
358-
}
359-
360332
/// A short-hand alias for the two-level query result (1. accessing the contract, 2. executing query in the contract)
361333
pub type QuerierResult = SystemResult<ContractResult<Binary>>;
362334

0 commit comments

Comments
 (0)