Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Jun 11, 2024
1 parent a3541e4 commit 9625952
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/experimental/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Experimental lints
40 changes: 40 additions & 0 deletions examples/general/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# General-purpose lints

## Use of `dylint_linting`'s `constituent` feature

The general-purpose lints use `dylint_linting`'s [`constituent` feature]. This allows the lints to be built in either of the following two configurations:

- as individual libraries
- as a single, combined `general` library

However, some additional organization of both the `general` directory and its subdirectories is required.

For the general directory itself:

- Each lint is listed under `[dependencies]` in general/Cargo.toml
- Each lint is listed under `[workspace.members]` in general/Cargo.toml
- Each lint's `register_lints` function is called from the `register_lints` function in src/lib.rs.

For each lint subdirectory:

- The following files do not appear, even though they would be created by `cargo dylint new`:
- .cargo/config.toml
- .gitignore
- rust-toolchain
- The lint's Cargo.toml has the following `[lib]` section (note: `crate-type` is not just `["cdylib"]`):
```toml
[lib]
crate-type = ["cdylib", "rlib"]
```
- The lint gets its `clippy_utils` dependency from the workspace, i.e.:
```toml
[dependencies]
clippy_utils = { workspace = true }
```
- The lint's Cargo.toml has the following `[features]` section:
```toml
[features]
rlib = ["dylint_linting/constituent"]
```

[`constituent` feature]: ../../utils/linting/README.md#constituent-feature
1 change: 1 addition & 0 deletions examples/restriction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Restriction lints
9 changes: 9 additions & 0 deletions examples/supplementary/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Supplementary lints

Like the [general-purpose lints], the supplementary lints use `dylint_linting`'s [`constituent` feature].

See the general-purpose lints' [documentation] for an explanation.

[`constituent` feature]: ../../utils/linting/README.md#constituent-feature
[documentation]: ../general/README.md
[general-purpose lints]: ../general
1 change: 1 addition & 0 deletions examples/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Testing lints

0 comments on commit 9625952

Please sign in to comment.