Skip to content

Commit

Permalink
refactor: replace static with const for global constants
Browse files Browse the repository at this point in the history
Signed-off-by: Integral <[email protected]>
  • Loading branch information
Integral-Tech authored and bnjbvr committed Dec 3, 2024
1 parent 50f036d commit 31bd5c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/matrix-sdk-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub use verification::{QrVerification, QrVerificationState, ScanError};
pub use vodozemac;

/// The version of the matrix-sdk-cypto crate being used
pub static VERSION: &str = env!("CARGO_PKG_VERSION");
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(test)]
matrix_sdk_test::init_tracing_for_tests!();
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/oidc/cross_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct SessionHash(Vec<u8>);

impl SessionHash {
fn to_hex(&self) -> String {
static CHARS: &[char; 16] =
const CHARS: &[char; 16] =
&['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
let mut res = String::with_capacity(2 * self.0.len() + 2);
if !self.0.is_empty() {
Expand Down
20 changes: 10 additions & 10 deletions crates/matrix-sdk/src/widget/settings/url_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
use url::Url;
use urlencoding::encode;

pub static USER_ID: &str = "$matrix_user_id";
pub static ROOM_ID: &str = "$matrix_room_id";
pub static WIDGET_ID: &str = "$matrix_widget_id";
pub static AVATAR_URL: &str = "$matrix_avatar_url";
pub static DISPLAY_NAME: &str = "$matrix_display_name";
pub static LANGUAGE: &str = "$org.matrix.msc2873.client_language";
pub static CLIENT_THEME: &str = "$org.matrix.msc2873.client_theme";
pub static CLIENT_ID: &str = "$org.matrix.msc2873.client_id";
pub static DEVICE_ID: &str = "$org.matrix.msc2873.matrix_device_id";
pub static HOMESERVER_URL: &str = "$org.matrix.msc4039.matrix_base_url";
pub const USER_ID: &str = "$matrix_user_id";
pub const ROOM_ID: &str = "$matrix_room_id";
pub const WIDGET_ID: &str = "$matrix_widget_id";
pub const AVATAR_URL: &str = "$matrix_avatar_url";
pub const DISPLAY_NAME: &str = "$matrix_display_name";
pub const LANGUAGE: &str = "$org.matrix.msc2873.client_language";
pub const CLIENT_THEME: &str = "$org.matrix.msc2873.client_theme";
pub const CLIENT_ID: &str = "$org.matrix.msc2873.client_id";
pub const DEVICE_ID: &str = "$org.matrix.msc2873.matrix_device_id";
pub const HOMESERVER_URL: &str = "$org.matrix.msc4039.matrix_base_url";

pub struct QueryProperties {
pub(crate) widget_id: String,
Expand Down

0 comments on commit 31bd5c6

Please sign in to comment.