common: Use the re-exported versions of js_int and assign

master
Damir Jelić 2021-01-04 15:29:49 +01:00
parent de51291166
commit 2e3b6fba7d
8 changed files with 17 additions and 29 deletions

View File

@ -98,11 +98,10 @@ use matrix_sdk_common::{
},
identifiers::{DeviceIdBox, EventId, RoomId, RoomIdOrAliasId, ServerName, UserId},
instant::{Duration, Instant},
js_int::UInt,
locks::RwLock,
presence::PresenceState,
uuid::Uuid,
FromHttpResponseError,
FromHttpResponseError, UInt,
};
#[cfg(feature = "encryption")]
@ -1001,7 +1000,6 @@ impl Client {
/// # use matrix_sdk::api::r0::filter::RoomEventFilter;
/// # use matrix_sdk::api::r0::message::get_message_events::Request as MessagesRequest;
/// # use url::Url;
/// # use matrix_sdk::js_int::UInt;
///
/// # let homeserver = Url::parse("http://example.com").unwrap();
/// let room_id = room_id!("!roomid:example.com");

View File

@ -48,7 +48,7 @@ use matrix_sdk_common::{
SyncStateEvent,
},
identifiers::{EventEncryptionAlgorithm, RoomAliasId, RoomId, UserId},
js_int::{int, uint, Int, UInt},
int, uint, Int, UInt,
};
use serde::{Deserialize, Serialize};
use tracing::{debug, error, trace};
@ -1140,7 +1140,7 @@ mod test {
identifiers::{event_id, room_id, user_id, UserId},
BaseClient, Session,
};
use matrix_sdk_common::js_int;
use matrix_sdk_common::{int, Int};
use matrix_sdk_test::{async_test, sync_response, EventBuilder, EventsJson, SyncResponseFile};
use std::{ops::Deref, time::SystemTime};
@ -1609,12 +1609,9 @@ mod test {
assert_eq!(room.joined_members.len(), 1);
assert!(room.power_levels.is_some());
assert_eq!(
room.power_levels.as_ref().unwrap().kick,
crate::js_int::int!(50)
);
assert_eq!(room.power_levels.as_ref().unwrap().kick, int!(50));
let admin = room.joined_members.get(&user_id).unwrap();
assert_eq!(admin.power_level.unwrap(), crate::js_int::int!(100));
assert_eq!(admin.power_level.unwrap(), int!(100));
}
#[async_test]
@ -1816,8 +1813,8 @@ mod test {
*content
.users
.entry(user_id.clone())
.or_insert_with(|| js_int::Int::new(4503599627370495).unwrap()) =
js_int::Int::new(4503599627370495).unwrap();
.or_insert_with(|| Int::new(4503599627370495).unwrap()) =
Int::new(4503599627370495).unwrap();
let power = SyncStateEvent {
event_id: event_id!("$h29iv0s8:example.com"),
origin_server_ts: SystemTime::now(),
@ -1831,8 +1828,8 @@ mod test {
Room::update_member_power(
&mut room_member,
&power,
js_int::Int::new(4503599627370495).unwrap(),
Int::new(4503599627370495).unwrap(),
);
assert_eq!(room_member.power_level_norm, Some(js_int::int!(100)))
assert_eq!(room_member.power_level_norm, Some(int!(100)))
}
}

View File

@ -18,8 +18,8 @@ use std::convert::TryFrom;
use matrix_sdk_common::{
events::{presence::PresenceEvent, room::member::MemberEventContent, SyncStateEvent},
identifiers::{RoomId, UserId},
js_int::{Int, UInt},
presence::PresenceState,
Int, UInt,
};
use serde::{Deserialize, Serialize};
@ -164,8 +164,7 @@ mod test {
use crate::{
identifiers::{room_id, user_id, RoomId},
js_int::int,
BaseClient, Session,
int, BaseClient, Session,
};
#[cfg(target_arch = "wasm32")]

View File

@ -14,7 +14,6 @@ version = "0.1.0"
unstable-synapse-quirks = ["ruma/unstable-synapse-quirks"]
[dependencies]
assign = "1.1.0"
instant = { version = "0.1.7", features = ["wasm-bindgen", "now"] }
[dependencies.ruma]

View File

@ -1,4 +1,3 @@
pub use assign::assign;
pub use instant;
pub use ruma::{
api::{
@ -6,11 +5,9 @@ pub use ruma::{
error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError, ServerError},
AuthScheme, EndpointError, OutgoingRequest,
},
directory, encryption, events,
events::exports::js_int,
identifiers, presence, push,
assign, directory, encryption, events, identifiers, int, presence, push,
serde::{CanonicalJsonValue, Raw},
thirdparty, Outgoing,
thirdparty, uint, Int, Outgoing, UInt,
};
pub use uuid;

View File

@ -38,10 +38,9 @@ use matrix_sdk_common::{
identifiers::{
DeviceId, DeviceIdBox, DeviceKeyAlgorithm, EventEncryptionAlgorithm, RoomId, UserId,
},
js_int::UInt,
locks::Mutex,
uuid::Uuid,
Raw,
Raw, UInt,
};
#[cfg(feature = "sqlite_cryptostore")]
@ -1186,7 +1185,7 @@ pub(crate) mod test {
/// These keys need to be periodically uploaded to the server.
type OneTimeKeys = BTreeMap<DeviceKeyId, OneTimeKey>;
use matrix_sdk_common::js_int::uint;
use matrix_sdk_common::uint;
fn alice_id() -> UserId {
user_id!("@alice:example.org")

View File

@ -41,9 +41,8 @@ use matrix_sdk_common::{
UserId,
},
instant::Instant,
js_int::UInt,
locks::Mutex,
CanonicalJsonValue, Raw,
CanonicalJsonValue, Raw, UInt,
};
use olm_rs::{
account::{IdentityKeys, OlmAccount, OneTimeKeys},

View File

@ -399,7 +399,7 @@ mod test {
use matrix_sdk_common::{
events::room::encryption::EncryptionEventContent, identifiers::EventEncryptionAlgorithm,
js_int::uint,
uint,
};
use super::{EncryptionSettings, ROTATION_MESSAGES, ROTATION_PERIOD};