---
title: "Crates to avoid"
description: "Crates that were once defaults but are unmaintained, replaced by the standard library, or superseded here, with the replacement for each and a cargo-deny config that enforces it."
---

> Documentation Index
> Fetch the complete documentation index at: https://codex.mirio.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Crates to avoid

Crates that show up in older codebases, tutorials, and LLM output, grouped by why they should not go into new code. Advisory IDs link to the [RustSec advisory database](https://rustsec.org/advisories/); `cargo deny check` flags every crate in the unmaintained table automatically. Status is as of November 2026.

## Maintained, but not the default

These are actively maintained and safe to depend on. The other crate pages choose differently for concrete reasons, and new code should follow those choices unless a dependency forces otherwise.

| Crate                                                                                              | Status                                                                                                                                | Default here                                       |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [`chrono`](https://crates.io/crates/chrono)                                                        | Maintained, regular 0.4 releases                                                                                                      | [`jiff`](https://codex.mirio.dev/rust/crates/data/#date-and-time)         |
| [`time`](https://crates.io/crates/time)                                                            | Maintained, regular 0.3 releases                                                                                                      | [`jiff`](https://codex.mirio.dev/rust/crates/data/#date-and-time)         |
| [`ring`](https://crates.io/crates/ring) 0.17                                                       | Maintained; the 2025 unmaintained advisory ([RUSTSEC-2025-0007](https://rustsec.org/advisories/RUSTSEC-2025-0007.html)) was withdrawn | [`aws-lc-rs`](https://codex.mirio.dev/rust/crates/security/#cryptography) |
| [`openssl`](https://crates.io/crates/openssl), [`native-tls`](https://crates.io/crates/native-tls) | Maintained bindings to the platform TLS library                                                                                       | [`rustls`](https://codex.mirio.dev/rust/crates/security/#tls)             |

**`chrono` and `time`.** Neither models IANA time zones as a first-class type: `chrono` needs `chrono-tz` for named zones and `time` handles fixed offsets only. Both represent calendar arithmetic ("add one month") through separate APIs from absolute durations. `jiff` puts time zones, DST-safe arithmetic, and calendar spans in one type system. Keep `chrono` or `time` where a dependency's public API uses their types, and convert at that boundary.

**`ring`.** `rustls`, `tokio-rustls`, and `reqwest` all default to `aws-lc-rs`, and `rustls`'s default post-quantum key exchange (`X25519MLKEM768`) and its `fips` feature are available only with `aws-lc-rs`. Adding `ring` alongside it means two crypto libraries in the binary and, for `rustls` and `jsonwebtoken`, a provider panic at startup. Versions of `ring` before 0.17 are unmaintained ([RUSTSEC-2025-0010](https://rustsec.org/advisories/RUSTSEC-2025-0010.html)) and should be upgraded wherever they appear.

**`openssl` and `native-tls`.** On Linux these link the host's OpenSSL, so TLS behavior and patch level follow the base image rather than `Cargo.lock`, and static or musl builds need OpenSSL built for the target. `rustls` compiles in and is versioned with the rest of the dependency tree. Keep `native-tls` only where the operating system's TLS stack is a requirement, such as honoring an enterprise trust policy on Windows or macOS.

## Replaced by the standard library

| Crate                                                 | Replacement                                                         | Stable since |
| ----------------------------------------------------- | ------------------------------------------------------------------- | ------------ |
| [`lazy_static`](https://crates.io/crates/lazy_static) | `std::sync::LazyLock`                                               | 1.80         |
| [`once_cell`](https://crates.io/crates/once_cell)     | `std::sync::OnceLock`, `std::sync::LazyLock`, `std::cell::OnceCell` | 1.70, 1.80   |
| [`async-trait`](https://crates.io/crates/async-trait) | `async fn` in traits                                                | 1.75         |
| [`atty`](https://crates.io/crates/atty)               | `std::io::IsTerminal`                                               | 1.70         |
| [`num_cpus`](https://crates.io/crates/num_cpus)       | `std::thread::available_parallelism`                                | 1.59         |

```rust
use std::sync::LazyLock;

static USER_AGENT: LazyLock<String> =
    LazyLock::new(|| format!("{}/{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")));
```

`atty` is also unmaintained and unsound ([RUSTSEC-2024-0375](https://rustsec.org/advisories/RUSTSEC-2024-0375.html), [RUSTSEC-2021-0145](https://rustsec.org/advisories/RUSTSEC-2021-0145.html)). The others are maintained and still appear transitively, which is harmless; the point is not to add them directly.

:::caution
Native `async fn` in traits does not replace `async-trait` everywhere. A trait with native `async
fn` is not object-safe, so `Box<dyn Store>` still needs `async-trait`. Callers also cannot require
the returned future to be `Send`, which `tokio::spawn` needs. For a public trait used across
tasks, declare the method as
`fn get(&self, id: Uuid) -> impl Future<Output = Result<User>> + Send;` and implement it with
`async fn`.
:::

## Unmaintained or discontinued

Each of these has a RustSec advisory, a deprecation notice from its maintainers, or both.

| Crate                                                           | Advisory                                                                             | Use instead                                                                                                                             |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| [`async-std`](https://crates.io/crates/async-std)               | [RUSTSEC-2025-0052](https://rustsec.org/advisories/RUSTSEC-2025-0052.html)           | [`tokio`](https://codex.mirio.dev/rust/crates/core/#runtime-and-http-server)                                                                                   |
| [`failure`](https://crates.io/crates/failure)                   | [RUSTSEC-2020-0036](https://rustsec.org/advisories/RUSTSEC-2020-0036.html)           | [`thiserror`, `anyhow`](https://codex.mirio.dev/rust/crates/core/#errors)                                                                                      |
| [`rustls-pemfile`](https://crates.io/crates/rustls-pemfile)     | [RUSTSEC-2025-0134](https://rustsec.org/advisories/RUSTSEC-2025-0134.html)           | [`rustls-pki-types`](https://codex.mirio.dev/rust/crates/security/#server) `PemObject`                                                                         |
| [`sodiumoxide`](https://crates.io/crates/sodiumoxide)           | [RUSTSEC-2021-0137](https://rustsec.org/advisories/RUSTSEC-2021-0137.html)           | [`aws-lc-rs`](https://codex.mirio.dev/rust/crates/security/#cryptography)                                                                                      |
| [`rust-crypto`](https://crates.io/crates/rust-crypto)           | [RUSTSEC-2016-0005](https://rustsec.org/advisories/RUSTSEC-2016-0005.html)           | [`aws-lc-rs`](https://codex.mirio.dev/rust/crates/security/#cryptography)                                                                                      |
| [`rusoto_*`](https://crates.io/crates/rusoto_core)              | [RUSTSEC-2022-0071](https://rustsec.org/advisories/RUSTSEC-2022-0071.html)           | [AWS SDK for Rust](https://github.com/awslabs/aws-sdk-rust) (`aws-sdk-*`)                                                               |
| [`bincode`](https://crates.io/crates/bincode)                   | [RUSTSEC-2025-0141](https://rustsec.org/advisories/RUSTSEC-2025-0141.html)           | [`postcard`](https://crates.io/crates/postcard), [`wincode`](https://crates.io/crates/wincode), [`rkyv`](https://crates.io/crates/rkyv) |
| [`serde_yaml`](https://crates.io/crates/serde_yaml)             | Deprecated by its author (0.9.34+deprecated)                                         | [`serde-saphyr`](https://crates.io/crates/serde-saphyr), [`serde_norway`](https://crates.io/crates/serde_norway)                        |
| [`serde_yml`](https://crates.io/crates/serde_yml)               | [RUSTSEC-2025-0068](https://rustsec.org/advisories/RUSTSEC-2025-0068.html) (unsound) | Same as `serde_yaml`                                                                                                                    |
| [`yaml-rust`](https://crates.io/crates/yaml-rust)               | [RUSTSEC-2024-0320](https://rustsec.org/advisories/RUSTSEC-2024-0320.html)           | [`saphyr`](https://crates.io/crates/saphyr), [`yaml-rust2`](https://crates.io/crates/yaml-rust2)                                        |
| [`serde_cbor`](https://crates.io/crates/serde_cbor)             | [RUSTSEC-2021-0127](https://rustsec.org/advisories/RUSTSEC-2021-0127.html)           | [`ciborium`](https://crates.io/crates/ciborium)                                                                                         |
| [`dotenv`](https://crates.io/crates/dotenv)                     | [RUSTSEC-2021-0141](https://rustsec.org/advisories/RUSTSEC-2021-0141.html)           | [`dotenvy`](https://crates.io/crates/dotenvy), for local development only                                                               |
| [`structopt`](https://crates.io/crates/structopt)               | [RUSTSEC-2022-0104](https://rustsec.org/advisories/RUSTSEC-2022-0104.html)           | [`clap`](https://crates.io/crates/clap) with the `derive` feature                                                                       |
| [`backoff`](https://crates.io/crates/backoff)                   | [RUSTSEC-2025-0012](https://rustsec.org/advisories/RUSTSEC-2025-0012.html)           | [`backon`](https://crates.io/crates/backon)                                                                                             |
| [`derivative`](https://crates.io/crates/derivative)             | [RUSTSEC-2024-0388](https://rustsec.org/advisories/RUSTSEC-2024-0388.html)           | [`derive_more`](https://crates.io/crates/derive_more), [`educe`](https://crates.io/crates/educe)                                        |
| [`paste`](https://crates.io/crates/paste)                       | [RUSTSEC-2024-0436](https://rustsec.org/advisories/RUSTSEC-2024-0436.html)           | [`pastey`](https://crates.io/crates/pastey)                                                                                             |
| [`proc-macro-error`](https://crates.io/crates/proc-macro-error) | [RUSTSEC-2024-0370](https://rustsec.org/advisories/RUSTSEC-2024-0370.html)           | [`proc-macro-error2`](https://crates.io/crates/proc-macro-error2), [`manyhow`](https://crates.io/crates/manyhow)                        |
| [`instant`](https://crates.io/crates/instant)                   | [RUSTSEC-2024-0384](https://rustsec.org/advisories/RUSTSEC-2024-0384.html)           | [`web-time`](https://crates.io/crates/web-time), or `std::time` outside Wasm                                                            |
| [`fxhash`](https://crates.io/crates/fxhash)                     | [RUSTSEC-2025-0057](https://rustsec.org/advisories/RUSTSEC-2025-0057.html)           | [`rustc-hash`](https://crates.io/crates/rustc-hash)                                                                                     |
| [`memmap`](https://crates.io/crates/memmap)                     | [RUSTSEC-2020-0077](https://rustsec.org/advisories/RUSTSEC-2020-0077.html)           | [`memmap2`](https://crates.io/crates/memmap2)                                                                                           |
| [`net2`](https://crates.io/crates/net2)                         | [RUSTSEC-2020-0016](https://rustsec.org/advisories/RUSTSEC-2020-0016.html)           | [`socket2`](https://crates.io/crates/socket2)                                                                                           |
| [`tempdir`](https://crates.io/crates/tempdir)                   | [RUSTSEC-2018-0017](https://rustsec.org/advisories/RUSTSEC-2018-0017.html)           | [`tempfile`](https://crates.io/crates/tempfile)                                                                                         |
| [`ansi_term`](https://crates.io/crates/ansi_term)               | [RUSTSEC-2021-0139](https://rustsec.org/advisories/RUSTSEC-2021-0139.html)           | [`anstyle`](https://crates.io/crates/anstyle), [`owo-colors`](https://crates.io/crates/owo-colors)                                      |
| [`tui`](https://crates.io/crates/tui)                           | [RUSTSEC-2023-0049](https://rustsec.org/advisories/RUSTSEC-2023-0049.html)           | [`ratatui`](https://crates.io/crates/ratatui)                                                                                           |

`bincode` 3.0.0 is a tombstone release whose library is a single `compile_error!`; the maintainers consider 1.3.3 complete. A `bincode = "1"` dependency still builds, but new formats should pick an alternative, and data persisted with `bincode` needs a migration plan rather than an upgrade.

For YAML, prefer TOML or JSON for configuration the service owns. YAML input from Kubernetes manifests or CI files still needs a parser; `serde-saphyr` is built on the pure-Rust `saphyr` parser, and `serde_norway` is a maintained fork of `serde_yaml` with a drop-in API.

## Pre-1.0 HTTP stack

`hyper` 0.14, `http` 0.2, and the crates built on them (`axum` before 0.7, `reqwest` before 0.12, `tonic` before 0.12) are a separate dependency tree from `hyper` 1.x. Types such as `http::Request` and `HeaderMap` from the two `http` versions are distinct and do not convert implicitly, so a single crate on the old stack forces a second copy of `hyper`, `http`, and `h2` into the build. `cargo tree -d -e normal` lists the duplicates; upgrade or replace whatever pulls in the 0.x versions.

## Enforcing it in CI

`cargo deny` checks the resolved dependency graph, including transitive crates, against the RustSec database and an explicit ban list. Put this `deny.toml` at the workspace root:

```toml
[advisories]
unmaintained = "all"
unsound = "all"
yanked = "deny"

[bans]
multiple-versions = "warn"
deny = [
  { crate = "ring", reason = "aws-lc-rs is the only crypto backend", use-instead = "aws-lc-rs" },
  { crate = "openssl", reason = "TLS uses rustls", use-instead = "rustls" },
  { crate = "native-tls", reason = "TLS uses rustls", use-instead = "rustls" },
]
```

```bash
cargo install cargo-deny --locked
cargo deny check advisories bans
```

The `advisories` table fails the build on every crate in the unmaintained table above. The `bans` table covers the crypto and TLS choices, which no advisory would flag. The [combined Cargo.toml](https://codex.mirio.dev/rust/crates/#cargotoml) passes all three bans.

A ban applies to transitive dependencies too, which is why `chrono`, `time`, `once_cell`, and `lazy_static` are not in the list: the stack on these pages already pulls them in transitively (`chrono` through `tracing-ndjson`, `time` through `jsonwebtoken`'s PEM support, `once_cell` through `rustls` and `dashmap`, `lazy_static` through `prometheus` and `tracing-subscriber`). That is harmless. Keep them out of `[dependencies]` in code review. When a banned crate is unavoidable behind a specific dependency, scope the exception with `wrappers`, which permits the crate only when the named parents pull it in.

Source: https://codex.mirio.dev/rust/crates/avoid/index.mdx
