Skip to content

Commit

Permalink
Auto merge of rust-lang#10487 - nyurik:readme-fixes, r=dswij
Browse files Browse the repository at this point in the history
Gramar, and spelin kleanup

A few minor cleanups in various markdown files, mostly focusing on spelling and ignoring non-compilable codeblocks. Also a few markdown tables, etc.

P.S. I'm no grammar expert, do take with a grain of salt.

changelog: none
  • Loading branch information
bors committed Mar 31, 2023
2 parents d43714a + 41b367f commit 89160b6
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 75 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Lints are divided into categories, each with a default [lint level](https://doc.
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.

| Category | Description | Default level |
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
|-----------------------|-------------------------------------------------------------------------------------|---------------|
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
Expand Down Expand Up @@ -130,7 +130,7 @@ for example.

You can add Clippy to Travis CI in the same way you use it locally:

```yml
```yaml
language: rust
rust:
- stable
Expand Down Expand Up @@ -253,7 +253,7 @@ rust-version = "1.30"

The MSRV can also be specified as an attribute, like below.

```rust
```rust,ignore
#![feature(custom_inner_attributes)]
#![clippy::msrv = "1.30.0"]
Expand Down
2 changes: 1 addition & 1 deletion book/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ much Clippy is supposed to ~~annoy~~ help you by changing the lint level by
category.

| Category | Description | Default level |
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
|-----------------------|-------------------------------------------------------------------------------------|---------------|
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
Expand Down
8 changes: 4 additions & 4 deletions book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> **Note:** The configuration file is unstable and may be deprecated in the future.
Some lints can be configured in a TOML file named `clippy.toml` or `.clippy.toml`. It contains a
basic `variable = value` mapping eg.
basic `variable = value` mapping e.g.

```toml
avoid-breaking-exported-api = false
Expand Down Expand Up @@ -60,7 +60,7 @@ And to warn on `lint_name`, run
cargo clippy -- -W clippy::lint_name
```

This also works with lint groups. For example you can run Clippy with warnings for all lints enabled:
This also works with lint groups. For example, you can run Clippy with warnings for all lints enabled:

```terminal
cargo clippy -- -W clippy::pedantic
Expand All @@ -84,7 +84,7 @@ msrv = "1.30.0"

The MSRV can also be specified as an attribute, like below.

```rust
```rust,ignore
#![feature(custom_inner_attributes)]
#![clippy::msrv = "1.30.0"]
Expand All @@ -96,7 +96,7 @@ fn main() {
You can also omit the patch version when specifying the MSRV, so `msrv = 1.30`
is equivalent to `msrv = 1.30.0`.

Note: `custom_inner_attributes` is an unstable feature so it has to be enabled explicitly.
Note: `custom_inner_attributes` is an unstable feature, so it has to be enabled explicitly.

Lints that recognize this configuration option can be
found [here](https://rust-lang.github.io/rust-clippy/master/index.html#msrv)
2 changes: 1 addition & 1 deletion book/src/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ making Clippy better by contributing to it. In that case, welcome to the
project!

> _Note:_ If you're just interested in using Clippy, there's nothing to see from
> this point onward and you should return to one of the earlier chapters.
> this point onward, and you should return to one of the earlier chapters.
## Getting started

Expand Down
24 changes: 12 additions & 12 deletions book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ because that's clearly a non-descriptive name.
- [Lint passes](#lint-passes)
- [Emitting a lint](#emitting-a-lint)
- [Adding the lint logic](#adding-the-lint-logic)
- [Specifying the lint's minimum supported Rust version (MSRV)](#specifying-the-lints-minimum-supported-rust-version-msrv)
- [Specifying the lint's minimum supported Rust version (MSRV)](#specifying-the-lints-minimum-supported-rust-version--msrv-)
- [Author lint](#author-lint)
- [Print HIR lint](#print-hir-lint)
- [Documentation](#documentation)
Expand Down Expand Up @@ -275,7 +275,7 @@ When declaring a new lint by hand and `cargo dev update_lints` is used, the lint
pass may have to be registered manually in the `register_plugins` function in
`clippy_lints/src/lib.rs`:

```rust
```rust,ignore
store.register_early_pass(|| Box::new(foo_functions::FooFunctions));
```

Expand All @@ -301,7 +301,7 @@ either [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass].

In short, the `LateLintPass` has access to type information while the
`EarlyLintPass` doesn't. If you don't need access to type information, use the
`EarlyLintPass`. The `EarlyLintPass` is also faster. However linting speed
`EarlyLintPass`. The `EarlyLintPass` is also faster. However, linting speed
hasn't really been a concern with Clippy so far.

Since we don't need type information for checking the function name, we used
Expand All @@ -318,7 +318,7 @@ implementation of the lint logic.

Let's start by implementing the `EarlyLintPass` for our `FooFunctions`:

```rust
```rust,ignore
impl EarlyLintPass for FooFunctions {
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
// TODO: Emit lint here
Expand All @@ -337,10 +337,10 @@ variety of lint emission functions. They can all be found in
[`clippy_utils/src/diagnostics.rs`][diagnostics].

`span_lint_and_help` seems most appropriate in this case. It allows us to
provide an extra help message and we can't really suggest a better name
provide an extra help message, and we can't really suggest a better name
automatically. This is how it looks:

```rust
```rust,ignore
impl EarlyLintPass for FooFunctions {
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
span_lint_and_help(
Expand Down Expand Up @@ -479,7 +479,7 @@ the value from `clippy.toml`. This can be accounted for using the
`extract_msrv_attr!(LintContext)` macro and passing
`LateContext`/`EarlyContext`.

```rust
```rust,ignore
impl<'tcx> LateLintPass<'tcx> for ManualStrip {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
...
Expand All @@ -493,7 +493,7 @@ the lint's test file, `tests/ui/manual_strip.rs` in this example. It should
have a case for the version below the MSRV and one with the same contents but
for the MSRV version itself.

```rust
```rust,ignore
...
#[clippy::msrv = "1.44"]
Expand Down Expand Up @@ -524,7 +524,7 @@ define_Conf! {

If you have trouble implementing your lint, there is also the internal `author`
lint to generate Clippy code that detects the offending pattern. It does not
work for all of the Rust syntax, but can give a good starting point.
work for all the Rust syntax, but can give a good starting point.

The quickest way to use it, is the [Rust playground:
play.rust-lang.org][author_example]. Put the code you want to lint into the
Expand Down Expand Up @@ -617,7 +617,7 @@ output in the `stdout` part.

## PR Checklist

Before submitting your PR make sure you followed all of the basic requirements:
Before submitting your PR make sure you followed all the basic requirements:

<!-- Sync this with `.github/PULL_REQUEST_TEMPLATE` -->

Expand All @@ -637,7 +637,7 @@ for some users. Adding a configuration is done in the following steps:

1. Adding a new configuration entry to [`clippy_lints::utils::conf`] like this:

```rust
```rust,ignore
/// Lint: LINT_NAME.
///
/// <The configuration field doc comment>
Expand Down Expand Up @@ -690,7 +690,7 @@ for some users. Adding a configuration is done in the following steps:
configuration value is now cloned or copied into a local value that is then
passed to the impl struct like this:

```rust
```rust,ignore
// Default generated registration:
store.register_*_pass(|| box module::StructName);

Expand Down
2 changes: 1 addition & 1 deletion book/src/development/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ We follow a rustc no merge-commit policy. See
## Common Abbreviations

| Abbreviation | Meaning |
| ------------ | -------------------------------------- |
|--------------|----------------------------------------|
| UB | Undefined Behavior |
| FP | False Positive |
| FN | False Negative |
Expand Down
14 changes: 7 additions & 7 deletions book/src/development/common_tools_writing_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You may need following tooltips to catch up with common operations.

- [Common tools for writing lints](#common-tools-for-writing-lints)
- [Retrieving the type of an expression](#retrieving-the-type-of-an-expression)
- [Retrieving the type of expression](#retrieving-the-type-of-expression)
- [Checking if an expr is calling a specific method](#checking-if-an-expr-is-calling-a-specific-method)
- [Checking for a specific type](#checking-for-a-specific-type)
- [Checking if a type implements a specific trait](#checking-if-a-type-implements-a-specific-trait)
Expand All @@ -16,7 +16,7 @@ Useful Rustc dev guide links:
- [Type checking](https://rustc-dev-guide.rust-lang.org/type-checking.html)
- [Ty module](https://rustc-dev-guide.rust-lang.org/ty.html)

## Retrieving the type of an expression
## Retrieving the type of expression

Sometimes you may want to retrieve the type `Ty` of an expression `Expr`, for
example to answer following questions:
Expand Down Expand Up @@ -45,7 +45,7 @@ impl LateLintPass<'_> for MyStructLint {
}
```

Similarly in [`TypeckResults`][TypeckResults] methods, you have the
Similarly, in [`TypeckResults`][TypeckResults] methods, you have the
[`pat_ty()`][pat_ty] method to retrieve a type from a pattern.

Two noticeable items here:
Expand Down Expand Up @@ -192,7 +192,7 @@ functions to deal with macros:
- `span.from_expansion()`: detects if a span is from macro expansion or
desugaring. Checking this is a common first step in a lint.

```rust
```rust,ignore
if expr.span.from_expansion() {
// just forget it
return;
Expand All @@ -203,11 +203,11 @@ functions to deal with macros:
if so, which macro call expanded it. It is sometimes useful to check if the
context of two spans are equal.

```rust
```rust,ignore
// expands to `1 + 0`, but don't lint
1 + mac!()
```
```rust
```rust,ignore
if left.span.ctxt() != right.span.ctxt() {
// the coder most likely cannot modify this expression
return;
Expand Down Expand Up @@ -246,7 +246,7 @@ functions to deal with macros:
`macro_rules!` with `a == $b`, `$b` is expanded to some expression with a
different context from `a`.

```rust
```rust,ignore
macro_rules! m {
($a:expr, $b:expr) => {
if $a.is_some() {
Expand Down
4 changes: 2 additions & 2 deletions book/src/development/infrastructure/book.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ guide to Clippy that you're reading right now. The Clippy book is formatted with
While not strictly necessary since the book source is simply Markdown text
files, having mdBook locally will allow you to build, test and serve the book
locally to view changes before you commit them to the repository. You likely
already have `cargo` installed, so the easiest option is to simply:
already have `cargo` installed, so the easiest option is to:

```shell
cargo install mdbook
Expand All @@ -26,7 +26,7 @@ instructions for other options.

The book's
[src](https://github.com/rust-lang/rust-clippy/tree/master/book/src)
directory contains all of the markdown files used to generate the book. If you
directory contains all the markdown files used to generate the book. If you
want to see your changes in real time, you can use the mdBook `serve` command to
run a web server locally that will automatically update changes as they are
made. From the top level of your `rust-clippy` directory:
Expand Down
2 changes: 1 addition & 1 deletion book/src/development/infrastructure/changelog_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Look for the [`beta-accepted`] label and make sure to also include the PRs with
that label in the changelog. If you can, remove the `beta-accepted` labels
**after** the changelog PR was merged.

> _Note:_ Some of those PRs might even got backported to the previous `beta`.
> _Note:_ Some of those PRs might even get backported to the previous `beta`.
> Those have to be included in the changelog of the _previous_ release.
### 4. Update `clippy::version` attributes
Expand Down
2 changes: 1 addition & 1 deletion book/src/development/infrastructure/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $ git push origin backport_remerge # This can be pushed to your fork
```

After this, open a PR to the master branch. In this PR, the commit hash of the
`HEAD` of the `beta` branch must exists. In addition to that, no files should be
`HEAD` of the `beta` branch must exist. In addition to that, no files should be
changed by this PR.

## Update the `beta` branch
Expand Down
8 changes: 4 additions & 4 deletions book/src/development/infrastructure/sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sudo chown --reference=/usr/lib/git-core/git-subtree~ /usr/lib/git-core/git-subt
> _Note:_ If you are a Debian user, `dash` is the shell used by default for
> scripts instead of `sh`. This shell has a hardcoded recursion limit set to
> 1000. In order to make this process work, you need to force the script to run
> 1,000. In order to make this process work, you need to force the script to run
> `bash` instead. You can do this by editing the first line of the `git-subtree`
> script and changing `sh` to `bash`.
Expand All @@ -71,10 +71,10 @@ $ git remote add clippy-local /path/to/rust-clippy
## Performing the sync from [`rust-lang/rust`] to Clippy

Here is a TL;DR version of the sync process (all of the following commands have
Here is a TL;DR version of the sync process (all the following commands have
to be run inside the `rust` directory):

1. Clone the [`rust-lang/rust`] repository or make sure it is up to date.
1. Clone the [`rust-lang/rust`] repository or make sure it is up-to-date.
2. Checkout the commit from the latest available nightly. You can get it using
`rustup check`.
3. Sync the changes to the rust-copy of Clippy to your Clippy fork:
Expand Down Expand Up @@ -107,7 +107,7 @@ to be run inside the `rust` directory):

## Performing the sync from Clippy to [`rust-lang/rust`]

All of the following commands have to be run inside the `rust` directory.
All the following commands have to be run inside the `rust` directory.

1. Make sure you have checked out the latest `master` of `rust-lang/rust`.
2. Sync the `rust-lang/rust-clippy` master to the rust-copy of Clippy:
Expand Down
2 changes: 1 addition & 1 deletion book/src/development/proposals/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ or around Clippy in the long run.
Besides adding more and more lints and improve the lints that Clippy already
has, Clippy is also interested in making the experience of its users, developers
and maintainers better over time. Projects that address bigger picture things
like this usually take more time and it is useful to have a proposal for those
like this usually take more time, and it is useful to have a proposal for those
first. This is the place where such proposals are collected, so that we can
refer to them when working on them.
6 changes: 3 additions & 3 deletions book/src/development/proposals/roadmap-2021.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ In the following, plans to improve the usability are covered.

#### No Output After `cargo check`

Currently when `cargo clippy` is run after `cargo check`, it does not produce
any output. This is especially problematic since `rust-analyzer` is on the rise
Currently, when `cargo clippy` is run after `cargo check`, it does not produce
any output. This is especially problematic since `rust-analyzer` is on the rise,
and it uses `cargo check` for checking code. A fix is already implemented, but
it still has to be pushed over the finish line. This also includes the
stabilization of the `cargo clippy --fix` command or the support of multi-span
Expand Down Expand Up @@ -221,7 +221,7 @@ regarding the user facing issues.

Rust's roadmap process was established by [RFC 1728] in 2016. Since then every
year a roadmap was published, that defined the bigger plans for the coming
years. This years roadmap can be found [here][Rust Roadmap 2021].
years. This year roadmap can be found [here][Rust Roadmap 2021].

[RFC 1728]: https://rust-lang.github.io/rfcs/1728-north-star.html

Expand Down
Loading

0 comments on commit 89160b6

Please sign in to comment.