<!--
title: Document feature flags
domain: app-frameworks
topic: Configurations
language: TOML
source: tokio-rs/axum
updated: 
url: https://awesomereviewers.com/reviewers/axum-document-feature-flags/
-->

When configuring feature flags in Cargo.toml, ensure they are properly structured and documented:

1. **Chain feature dependencies correctly** - Features that depend on other features should explicitly list those dependencies:
```toml
# Incorrect:
cookie-signed = ["cookie-lib/signed"]

# Correct:
cookie-signed = ["cookie", "cookie-lib/signed"]
```

2. **Document non-obvious configuration choices** with comments to help other developers understand your reasoning:
```toml
# `default-features = false` to not depend on tokio which doesn't support compiling to wasm
axum = { path = "../../axum", default-features = false }
```

3. **Use appropriate syntax for conditional feature activation**, understanding special operators like `?` for optional dependencies:
```toml
async-read-body = ["dep:tokio-util", "tokio-util?/io"]
```

These practices ensure that your configuration is both functionally correct and easier for other developers to understand and maintain.
