Skip to content

Commit

Permalink
Revert back to Rust stable (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra authored Jan 20, 2024
1 parent be0e89b commit 9952867
Show file tree
Hide file tree
Showing 27 changed files with 79 additions and 60 deletions.
42 changes: 27 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/kitsune-activitypub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version.workspace = true
[dependencies]
async-trait = "0.1.77"
autometrics = { version = "1.0.0", default-features = false }
base64-simd = { version = "0.8.0", features = ["unstable"] }
base64-simd = "0.8.0"
diesel = "2.1.4"
diesel-async = "0.4.1"
futures-util = "0.3.30"
Expand All @@ -33,7 +33,7 @@ rsa = "0.9.6"
scoped-futures = "0.1.3"
serde = "1.0.195"
sha2 = "0.10.8"
simd-json = { version = "0.13.7", features = ["hints"] }
simd-json = "0.13.8"
speedy-uuid = { path = "../../lib/speedy-uuid" }
thiserror = "1.0.56"
tracing = "0.1.40"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum_dispatch = "0.3.12"
moka = { version = "0.12.3", features = ["sync"] }
redis = "0.24.0"
serde = "1.0.195"
simd-json = "0.13.7"
simd-json = "0.13.8"
thiserror = "1.0.56"
tracing = "0.1.40"
typed-builder = "0.18.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-captcha/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ http = "1.0.0"
kitsune-http-client = { path = "../kitsune-http-client" }
serde = { version = "1.0.195", features = ["derive"] }
serde_urlencoded = "0.7.1"
simd-json = "0.13.7"
simd-json = "0.13.8"
strum = { version = "0.25.0", features = ["derive"] }
thiserror = "1.0.56"
typed-builder = "0.18.1"
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
build = "build.rs"

[dependencies]
diesel = { version = "2.1.4", features = ["nightly-error-messages", "uuid"] }
diesel = { version = "2.1.4", features = ["uuid"] }
diesel-async = { version = "0.4.1", features = [
"async-connection-wrapper",
"deadpool",
Expand All @@ -23,7 +23,7 @@ miette = "5.10.0"
num-derive = "0.4.1"
num-traits = "0.2.17"
serde = { version = "1.0.195", features = ["derive"] }
simd-json = "0.13.7"
simd-json = "0.13.8"
speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] }
thiserror = "1.0.56"
tracing-log = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-http-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kitsune-http-signatures = { path = "../kitsune-http-signatures" }
kitsune-type = { path = "../kitsune-type" }
pin-project = "1.1.3"
serde = "1.0.195"
simd-json = "0.13.7"
simd-json = "0.13.8"
tower = { version = "0.4.13", features = ["util"] }
tower-http = { version = "0.5.1", features = [
# Explicitly exclude `zstd`
Expand Down
3 changes: 2 additions & 1 deletion crates/kitsune-http-signatures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ authors.workspace = true
edition.workspace = true

[dependencies]
base64-simd = { version = "0.8.0", features = ["unstable"] }
base64-simd = "0.8.0"
derive_builder = "0.12.0"
http = "1.0.0"
kitsune-blocking = { path = "../kitsune-blocking" }
itertools = { version = "0.12.0", default-features = false }
ring = { version = "0.17.7", features = ["std"] }
time = { version = "0.3.31", default-features = false, features = [
"formatting",
Expand Down
14 changes: 8 additions & 6 deletions crates/kitsune-http-signatures/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ impl TryFrom<SignatureHeader<'_>> for String {

fn try_from(value: SignatureHeader<'_>) -> Result<Self, Self::Error> {
let signature = base64_simd::STANDARD.encode_to_string(value.signature);
let headers = value
.signature_components
.iter()
.map(SignatureComponent::as_str)
.intersperse(" ")
.collect::<String>();
let headers = itertools::intersperse(
value
.signature_components
.iter()
.map(SignatureComponent::as_str),
" ",
)
.collect::<String>();

let mut signature_header = format!(
"keyId=\"{}\",signature=\"{signature}\",headers=\"{headers}\"",
Expand Down
1 change: 0 additions & 1 deletion crates/kitsune-http-signatures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! Only supports asymmetric signing schemes (aka. no HMAC and such)
//!
#![feature(iter_intersperse)]
#![deny(missing_docs)]

use crate::{header::SignatureHeader, util::UnixTimestampExt};
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-mastodon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ kitsune-util = { path = "../kitsune-util" }
mime = "0.3.17"
scoped-futures = "0.1.3"
serde = "1.0.195"
simd-json = "0.13.7"
simd-json = "0.13.8"
smol_str = "0.2.1"
speedy-uuid = { path = "../../lib/speedy-uuid" }
thiserror = "1.0.56"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-messaging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ redis = { version = "0.24.0", features = [
"tokio-rustls-comp",
] }
serde = "1.0.195"
simd-json = "0.13.7"
simd-json = "0.13.8"
tokio = { version = "1.35.1", features = ["macros", "rt", "sync"] }
tokio-stream = { version = "0.1.14", features = ["sync"] }
tracing = "0.1.40"
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-oidc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ openidconnect = { version = "3.4.0", default-features = false, features = [
] }
redis = "0.24.0"
serde = { version = "1.0.195", features = ["derive"] }
simd-json = "0.13.7"
simd-json = "0.13.8"
speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] }
thiserror = "1.0.56"
url = "2.5.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/kitsune-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rsa = "0.9.6"
rusty-s3 = { version = "0.5.0", default-features = false }
scoped-futures = "0.1.3"
serde = "1.0.195"
simd-json = "0.13.7"
simd-json = "0.13.8"
smol_str = "0.2.1"
speedy-uuid = { path = "../../lib/speedy-uuid" }
thiserror = "1.0.56"
Expand All @@ -66,7 +66,7 @@ zxcvbn = { version = "2.2.2", default-features = false }
meilisearch = ["kitsune-search/meilisearch"]

[dev-dependencies]
hex-simd = { version = "0.8.0", features = ["unstable"] }
hex-simd = "0.8.0"
http-body-util = "0.1.0"
hyper = "1.1.0"
kitsune-activitypub = { path = "../kitsune-activitypub" }
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition.workspace = true
[dependencies]
iso8601-timestamp = "0.2.16"
serde = { version = "1.0.195", features = ["derive"] }
simd-json = "0.13.7"
simd-json = "0.13.8"
smol_str = { version = "0.2.1", features = ["serde"] }
speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] }
utoipa = { version = "4.2.0", features = ["chrono", "uuid"] }
Expand Down
7 changes: 7 additions & 0 deletions crates/kitsune-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ pub fn generate_secret() -> String {
.collect()
}

const _: () = {
assert!(
std::mem::size_of::<CowBox<'_, [u8; 1024]>>() <= std::mem::size_of::<usize>() * 2,
"Size guarantee violated (should have the size of two or less machine words)",
);
};

#[derive(Clone, Debug)]
pub enum CowBox<'a, T> {
Borrowed(&'a T),
Expand Down
2 changes: 1 addition & 1 deletion crates/kitsune-webfinger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tracing = "0.1.40"
http-body-util = "0.1.0"
hyper = "1.1.0"
pretty_assertions = "1.4.0"
simd-json = { version = "0.13.7", features = ["hints"] }
simd-json = "0.13.8"
tokio = { version = "1.35.1", features = ["macros"] }
tower = { version = "0.4.13", default-features = false, features = ["util"] }

Expand Down
6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
inherit overlays system;
};
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.nightly.latest.minimal;
rustc = pkgs.rust-bin.nightly.latest.minimal;
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
baseDependencies = with pkgs; [
openssl
Expand Down Expand Up @@ -128,7 +128,7 @@
packages = with pkgs; [
cargo-insta
diesel-cli
rust-bin.nightly.latest.default
rust-bin.stable.latest.default
]
++
baseDependencies;
Expand Down
3 changes: 2 additions & 1 deletion kitsune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ headers = "0.4.0"
http = "1.0.0"
http-body-util = "0.1.0"
iso8601-timestamp = "0.2.16"
itertools = { version = "0.12.0", default-features = false }
kitsune-activitypub = { path = "../crates/kitsune-activitypub" }
kitsune-blocking = { path = "../crates/kitsune-blocking" }
kitsune-cache = { path = "../crates/kitsune-cache" }
Expand Down Expand Up @@ -79,7 +80,7 @@ rust-embed = { version = "8.2.0", features = ["include-exclude"] }
scoped-futures = "0.1.3"
serde = { version = "1.0.195", features = ["derive"] }
serde_urlencoded = "0.7.1"
simd-json = "0.13.7"
simd-json = "0.13.8"
speedy-uuid = { path = "../lib/speedy-uuid" }
strum = { version = "0.25.0", features = ["derive", "phf"] }
tempfile = "3.9.0"
Expand Down
13 changes: 7 additions & 6 deletions kitsune/src/http/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ where
type Error = Error;

fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
let value = self
.0
.into_iter()
.map(|(key, value)| Cow::Owned(format!("<{value}>; rel=\"{key}\"")))
.intersperse(Cow::Borrowed(", "))
.collect::<String>();
let value = itertools::intersperse(
self.0
.into_iter()
.map(|(key, value)| Cow::Owned(format!("<{value}>; rel=\"{key}\""))),
Cow::Borrowed(", "),
)
.collect::<String>();

res.headers_mut().insert(
"Link",
Expand Down
2 changes: 0 additions & 2 deletions kitsune/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(iter_intersperse)]

#[macro_use]
extern crate metrics;

Expand Down
3 changes: 1 addition & 2 deletions kitsune/src/oauth2/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ impl Registrar for OAuthRegistrar {
if valid_scopes.peek().is_none() {
OAuthScope::Read.as_ref().parse().unwrap()
} else {
valid_scopes
.intersperse(" ")
itertools::intersperse(valid_scopes, " ")
.collect::<String>()
.parse()
.unwrap()
Expand Down
Loading

0 comments on commit 9952867

Please sign in to comment.