From 593bad77802ad18ad353a5309b561ad6c288dcd5 Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Wed, 10 Apr 2024 23:42:37 -0400
Subject: [PATCH] remove unnecessary malloc imports, remove cargo.toml env
check
Signed-off-by: strawberry <strawberry@puppygock.gay>
---
Cargo.toml | 1 -
src/main.rs | 15 ++-------------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 9bc2ccb6..a8cffba4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -308,7 +308,6 @@ hyperlocal = { git = "https://github.com/softprops/hyperlocal", rev = "2ee4d1496
"server",
] } # unix socket support
-[target.'cfg(all(not(target_env = "msvc"), not(target_os = "macos"), target_os = "linux"))'.dependencies]
hardened_malloc-rs = { version = "0.1", optional = true, features = [
"static",
"clang",
diff --git a/src/main.rs b/src/main.rs
index 30932d23..9eefca2e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -24,8 +24,6 @@ use ruma::api::client::{
error::{Error as RumaError, ErrorBody, ErrorKind},
uiaa::UiaaResponse,
};
-#[cfg(all(not(target_env = "msvc"), feature = "jemalloc", not(feature = "hardened_malloc")))]
-use tikv_jemallocator::Jemalloc;
use tokio::{
signal,
sync::oneshot::{self, Sender},
@@ -44,16 +42,7 @@ mod routes;
#[cfg(all(not(target_env = "msvc"), feature = "jemalloc", not(feature = "hardened_malloc")))]
#[global_allocator]
-static GLOBAL: Jemalloc = Jemalloc;
-
-#[cfg(all(
- not(target_env = "msvc"),
- not(target_os = "macos"),
- not(feature = "jemalloc"),
- feature = "hardened_malloc",
- target_os = "linux"
-))]
-use hardened_malloc_rs::HardenedMalloc;
+static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
#[cfg(all(
not(target_env = "msvc"),
@@ -63,7 +52,7 @@ use hardened_malloc_rs::HardenedMalloc;
not(feature = "jemalloc")
))]
#[global_allocator]
-static GLOBAL: HardenedMalloc = HardenedMalloc;
+static GLOBAL: hardened_malloc_rs::HardenedMalloc = hardened_malloc_rs::HardenedMalloc;
struct Server {
config: Config,