mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-22 21:42:40 +00:00
build: migrate to Rust edition 2024
This commit is contained in:
parent
37fbf5149e
commit
2e0a878d56
22 changed files with 64 additions and 64 deletions
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "blah-types"
|
||||
version = "0.0.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
[features]
|
||||
default = ["ed25519-dalek/default"]
|
||||
|
|
|
@ -3,11 +3,11 @@ use std::hint::black_box;
|
|||
use std::time::Instant;
|
||||
|
||||
use blah_types::msg::{ChatPayload, UserRegisterChallengeResponse, UserRegisterPayload};
|
||||
use blah_types::{get_timestamp, Id, PubKey, SignExt, Signee, UserKey};
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use blah_types::{Id, PubKey, SignExt, Signee, UserKey, get_timestamp};
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use ed25519_dalek::SigningKey;
|
||||
use rand::rngs::mock::StepRng;
|
||||
use rand::rngs::StdRng;
|
||||
use rand::rngs::mock::StepRng;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
|
@ -24,7 +24,7 @@ fn bench_register_pow(c: &mut Criterion) {
|
|||
id_key: id_key.clone(),
|
||||
server_url: "http://some.example.com".parse().unwrap(),
|
||||
id_url: "http://another.example.com".parse().unwrap(),
|
||||
challenge: Some(UserRegisterChallengeResponse::Pow { nonce: rng.gen() }),
|
||||
challenge: Some(UserRegisterChallengeResponse::Pow { nonce: rng.r#gen() }),
|
||||
};
|
||||
let mut signee = Signee {
|
||||
nonce: 0,
|
||||
|
@ -35,7 +35,7 @@ fn bench_register_pow(c: &mut Criterion) {
|
|||
|
||||
c.bench_function("register_pow_iter", |b| {
|
||||
b.iter_custom(|iters| {
|
||||
signee.nonce = rng.gen();
|
||||
signee.nonce = rng.r#gen();
|
||||
|
||||
let inst = Instant::now();
|
||||
for _ in 0..iters {
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::fmt;
|
|||
use std::str::FromStr;
|
||||
|
||||
use ed25519_dalek::{
|
||||
Signature, SignatureError, Signer, SigningKey, VerifyingKey, PUBLIC_KEY_LENGTH,
|
||||
SIGNATURE_LENGTH,
|
||||
PUBLIC_KEY_LENGTH, SIGNATURE_LENGTH, Signature, SignatureError, Signer, SigningKey,
|
||||
VerifyingKey,
|
||||
};
|
||||
use rand::RngCore;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
@ -3,7 +3,7 @@ pub use bitflags;
|
|||
pub use ed25519_dalek;
|
||||
pub use url;
|
||||
|
||||
pub use crypto::{get_timestamp, PubKey, SignExt, Signed, Signee, UserKey};
|
||||
pub use crypto::{PubKey, SignExt, Signed, Signee, UserKey, get_timestamp};
|
||||
pub use msg::Id;
|
||||
|
||||
#[cfg(not(feature = "schemars"))]
|
||||
|
@ -24,8 +24,8 @@ macro_rules! impl_json_schema_as {
|
|||
concat!(module_path!(), "::", stringify!($ty)).into()
|
||||
}
|
||||
|
||||
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||
gen.subschema_for::<$as_ty>()
|
||||
fn json_schema(g: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||
g.subschema_for::<$as_ty>()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::fmt;
|
|||
use std::num::ParseIntError;
|
||||
use std::str::FromStr;
|
||||
|
||||
use serde::{de, ser, Deserialize, Serialize};
|
||||
use serde::{Deserialize, Serialize, de, ser};
|
||||
use url::Url;
|
||||
|
||||
use crate::identity::IdUrl;
|
||||
|
@ -244,7 +244,7 @@ impl RichText {
|
|||
struct Fmt<'a>(&'a RichText);
|
||||
impl fmt::Display for Fmt<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
for p in &self.0 .0 {
|
||||
for p in &self.0.0 {
|
||||
f.write_str(&p.text)?;
|
||||
}
|
||||
Ok(())
|
||||
|
@ -259,7 +259,7 @@ impl RichText {
|
|||
struct Fmt<'a>(&'a RichText);
|
||||
impl fmt::Display for Fmt<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
for p in &self.0 .0 {
|
||||
for p in &self.0.0 {
|
||||
let tags = [
|
||||
(p.attrs.bold, "<b>", "</b>"),
|
||||
(p.attrs.code, "<code>", "</code>"),
|
||||
|
@ -490,9 +490,9 @@ impl_for_bitflags!(ServerPermission, MemberPermission, RoomAttrs);
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ed25519_dalek::{SigningKey, PUBLIC_KEY_LENGTH};
|
||||
use expect_test::expect;
|
||||
use AddMemberPayload;
|
||||
use ed25519_dalek::{PUBLIC_KEY_LENGTH, SigningKey};
|
||||
use expect_test::expect;
|
||||
|
||||
use crate::SignExt;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ed25519_dalek::{VerifyingKey, PUBLIC_KEY_LENGTH};
|
||||
use ed25519_dalek::{PUBLIC_KEY_LENGTH, VerifyingKey};
|
||||
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSqlOutput, ValueRef};
|
||||
use rusqlite::{Result, ToSql};
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ use std::fmt;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use crate::PubKey;
|
||||
use crate::identity::UserIdentityDesc;
|
||||
use crate::msg::{Id, MemberPermission, RoomAttrs, SignedChatMsgWithId};
|
||||
use crate::PubKey;
|
||||
|
||||
/// The response object returned as body on HTTP error status.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue