Skip to content

Commit

Permalink
Auto merge of rust-lang#7502 - flip1995:rollup-y3ho3w0, r=flip1995
Browse files Browse the repository at this point in the history
Rollup of 3 pull requests

Successful merges:

 - rust-lang#7279 (Adapting the lint list to Clippy's new metadata format)
 - rust-lang#7298 (Switch CI to new metadata collection)
 - rust-lang#7420 (Update lint documentation to use markdown headlines)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

changelog: rollup
  • Loading branch information
bors committed Jul 28, 2021
2 parents ac0fd99 + 464c85c commit 92ca25b
Show file tree
Hide file tree
Showing 238 changed files with 2,916 additions and 2,751 deletions.
9 changes: 4 additions & 5 deletions .github/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ rm -rf out/master/ || exit 0
echo "Making the docs for master"
mkdir out/master/
cp util/gh-pages/index.html out/master
python3 ./util/export.py out/master/lints.json
cp util/gh-pages/lints.json out/master

if [[ -n $TAG_NAME ]]; then
echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it"
cp -r out/master "out/$TAG_NAME"
rm -f out/stable
ln -s "$TAG_NAME" out/stable
cp -Tr out/master "out/$TAG_NAME"
ln -sf "$TAG_NAME" out/stable
fi

if [[ $BETA = "true" ]]; then
Expand All @@ -28,8 +27,8 @@ cp util/gh-pages/versions.html out/index.html
echo "Making the versions.json file"
python3 ./util/versions.py out

cd out
# Now let's go have some fun with the cloned repo
cd out
git config user.name "GHA CI"
git config user.email "gha@ci.invalid"

Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@ jobs:
if: github.ref == 'refs/heads/beta'
run: echo "BETA=true" >> $GITHUB_ENV

- name: Use scripts and templates from master branch
# We need to check out all files that (transitively) depend on the
# structure of the gh-pages branch, so that we're able to change that
# structure without breaking the deployment.
- name: Use deploy files from master branch
run: |
git fetch --no-tags --prune --depth=1 origin master
git checkout origin/master -- .github/deploy.sh util/gh-pages/ util/*.py
git checkout origin/master -- .github/deploy.sh util/versions.py util/gh-pages/versions.html
# Generate lockfile for caching to avoid build problems with cached deps
- name: cargo generate-lockfile
run: cargo generate-lockfile

- name: Cache
uses: Swatinem/rust-cache@v1.3.0

- name: cargo collect-metadata
run: cargo collect-metadata

- name: Deploy
run: |
Expand Down
9 changes: 3 additions & 6 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,11 @@ use rustc_session::{{declare_lint_pass, declare_tool_lint}};
{pass_import}
declare_clippy_lint! {{
/// **What it does:**
/// ### What it does
///
/// **Why is this bad?**
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Why is this bad?
///
/// ### Example
/// ```rust
/// // example code where clippy issues a warning
/// ```
Expand Down
4 changes: 2 additions & 2 deletions clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub fn run(port: u16, lint: Option<&str>) -> ! {

loop {
if mtime("util/gh-pages/lints.json") < mtime("clippy_lints/src") {
Command::new("python3")
.arg("util/export.py")
Command::new("cargo")
.arg("collect-metadata")
.spawn()
.unwrap()
.wait()
Expand Down
12 changes: 7 additions & 5 deletions clippy_lints/src/absurd_extreme_comparisons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ use clippy_utils::ty::is_isize_or_usize;
use clippy_utils::{clip, int_bits, unsext};

declare_clippy_lint! {
/// **What it does:** Checks for comparisons where one side of the relation is
/// ### What it does
/// Checks for comparisons where one side of the relation is
/// either the minimum or maximum value for its type and warns if it involves a
/// case that is always true or always false. Only integer and boolean types are
/// checked.
///
/// **Why is this bad?** An expression like `min <= x` may misleadingly imply
/// ### Why is this bad?
/// An expression like `min <= x` may misleadingly imply
/// that it is possible for `x` to be less than the minimum. Expressions like
/// `max < x` are probably mistakes.
///
/// **Known problems:** For `usize` the size of the current compile target will
/// ### Known problems
/// For `usize` the size of the current compile target will
/// be assumed (e.g., 64 bits on 64 bit systems). This means code that uses such
/// a comparison to detect target pointer width will trigger this lint. One can
/// use `mem::sizeof` and compare its value or conditional compilation
/// attributes
/// like `#[cfg(target_pointer_width = "64")] ..` instead.
///
/// **Example:**
///
/// ### Example
/// ```rust
/// let vec: Vec<isize> = Vec::new();
/// if vec.len() <= 0 {}
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ use rustc_span::symbol;
use std::f64::consts as f64;

declare_clippy_lint! {
/// **What it does:** Checks for floating point literals that approximate
/// ### What it does
/// Checks for floating point literals that approximate
/// constants which are defined in
/// [`std::f32::consts`](https://doc.rust-lang.org/stable/std/f32/consts/#constants)
/// or
/// [`std::f64::consts`](https://doc.rust-lang.org/stable/std/f64/consts/#constants),
/// respectively, suggesting to use the predefined constant.
///
/// **Why is this bad?** Usually, the definition in the standard library is more
/// ### Why is this bad?
/// Usually, the definition in the standard library is more
/// precise than what people come up with. If you find that your definition is
/// actually more precise, please [file a Rust
/// issue](https://github.com/rust-lang/rust/issues).
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
/// ```rust
/// let x = 3.14;
/// let y = 1_f64 / x;
Expand Down
20 changes: 10 additions & 10 deletions clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;

declare_clippy_lint! {
/// **What it does:** Checks for integer arithmetic operations which could overflow or panic.
/// ### What it does
/// Checks for integer arithmetic operations which could overflow or panic.
///
/// Specifically, checks for any operators (`+`, `-`, `*`, `<<`, etc) which are capable
/// of overflowing according to the [Rust
/// Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow),
/// or which can panic (`/`, `%`). No bounds analysis or sophisticated reasoning is
/// attempted.
///
/// **Why is this bad?** Integer overflow will trigger a panic in debug builds or will wrap in
/// ### Why is this bad?
/// Integer overflow will trigger a panic in debug builds or will wrap in
/// release mode. Division by zero will cause a panic in either mode. In some applications one
/// wants explicitly checked, wrapping or saturating arithmetic.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
/// ```rust
/// # let a = 0;
/// a + 1;
Expand All @@ -31,14 +31,14 @@ declare_clippy_lint! {
}

declare_clippy_lint! {
/// **What it does:** Checks for float arithmetic.
/// ### What it does
/// Checks for float arithmetic.
///
/// **Why is this bad?** For some embedded systems or kernel development, it
/// ### Why is this bad?
/// For some embedded systems or kernel development, it
/// can be useful to rule out floating-point numbers.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
/// ```rust
/// # let a = 0.0;
/// a + 1.0;
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/as_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:** Checks for usage of `as` conversions.
/// ### What it does
/// Checks for usage of `as` conversions.
///
/// Note that this lint is specialized in linting *every single* use of `as`
/// regardless of whether good alternatives exist or not.
Expand All @@ -15,14 +16,13 @@ declare_clippy_lint! {
/// There is a good explanation the reason why this lint should work in this way and how it is useful
/// [in this issue](https://github.com/rust-lang/rust-clippy/issues/5122).
///
/// **Why is this bad?** `as` conversions will perform many kinds of
/// ### Why is this bad?
/// `as` conversions will perform many kinds of
/// conversions, including silently lossy conversions and dangerous coercions.
/// There are cases when it makes sense to use `as`, so the lint is
/// Allow by default.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
/// ```rust,ignore
/// let a: u32;
/// ...
Expand Down
20 changes: 10 additions & 10 deletions clippy_lints/src/asm_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ fn check_expr_asm_syntax(lint: &'static Lint, cx: &EarlyContext<'_>, expr: &Expr
}

declare_clippy_lint! {
/// **What it does:** Checks for usage of Intel x86 assembly syntax.
/// ### What it does
/// Checks for usage of Intel x86 assembly syntax.
///
/// **Why is this bad?** The lint has been enabled to indicate a preference
/// ### Why is this bad?
/// The lint has been enabled to indicate a preference
/// for AT&T x86 assembly syntax.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
///
/// ```rust,no_run
/// # #![feature(asm)]
Expand Down Expand Up @@ -89,14 +89,14 @@ impl EarlyLintPass for InlineAsmX86IntelSyntax {
}

declare_clippy_lint! {
/// **What it does:** Checks for usage of AT&T x86 assembly syntax.
/// ### What it does
/// Checks for usage of AT&T x86 assembly syntax.
///
/// **Why is this bad?** The lint has been enabled to indicate a preference
/// ### Why is this bad?
/// The lint has been enabled to indicate a preference
/// for Intel x86 assembly syntax.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
///
/// ```rust,no_run
/// # #![feature(asm)]
Expand Down
11 changes: 7 additions & 4 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:** Checks for `assert!(true)` and `assert!(false)` calls.
/// ### What it does
/// Checks for `assert!(true)` and `assert!(false)` calls.
///
/// **Why is this bad?** Will be optimized out by the compiler or should probably be replaced by a
/// ### Why is this bad?
/// Will be optimized out by the compiler or should probably be replaced by a
/// `panic!()` or `unreachable!()`
///
/// **Known problems:** None
/// ### Known problems
/// None
///
/// **Example:**
/// ### Example
/// ```rust,ignore
/// assert!(false)
/// assert!(true)
Expand Down
22 changes: 14 additions & 8 deletions clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ use rustc_middle::hir::map::Map;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:** Checks for `a = a op b` or `a = b commutative_op a`
/// ### What it does
/// Checks for `a = a op b` or `a = b commutative_op a`
/// patterns.
///
/// **Why is this bad?** These can be written as the shorter `a op= b`.
/// ### Why is this bad?
/// These can be written as the shorter `a op= b`.
///
/// **Known problems:** While forbidden by the spec, `OpAssign` traits may have
/// ### Known problems
/// While forbidden by the spec, `OpAssign` traits may have
/// implementations that differ from the regular `Op` impl.
///
/// **Example:**
/// ### Example
/// ```rust
/// let mut a = 5;
/// let b = 0;
Expand All @@ -37,17 +40,20 @@ declare_clippy_lint! {
}

declare_clippy_lint! {
/// **What it does:** Checks for `a op= a op b` or `a op= b op a` patterns.
/// ### What it does
/// Checks for `a op= a op b` or `a op= b op a` patterns.
///
/// **Why is this bad?** Most likely these are bugs where one meant to write `a
/// ### Why is this bad?
/// Most likely these are bugs where one meant to write `a
/// op= b`.
///
/// **Known problems:** Clippy cannot know for sure if `a op= a op b` should have
/// ### Known problems
/// Clippy cannot know for sure if `a op= a op b` should have
/// been `a = a op a op b` or `a = a op b`/`a op= b`. Therefore, it suggests both.
/// If `a op= a op b` is really the correct behaviour it should be
/// written as `a = a op a op b` as it's less confusing.
///
/// **Example:**
/// ### Example
/// ```rust
/// let mut a = 5;
/// let b = 2;
Expand Down
11 changes: 5 additions & 6 deletions clippy_lints/src/async_yields_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:** Checks for async blocks that yield values of types
/// ### What it does
/// Checks for async blocks that yield values of types
/// that can themselves be awaited.
///
/// **Why is this bad?** An await is likely missing.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Why is this bad?
/// An await is likely missing.
///
/// ### Example
/// ```rust
/// async fn foo() {}
///
Expand Down
10 changes: 5 additions & 5 deletions clippy_lints/src/atomic_ordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// **What it does:** Checks for usage of invalid atomic
/// ### What it does
/// Checks for usage of invalid atomic
/// ordering in atomic loads/stores/exchanges/updates and
/// memory fences.
///
/// **Why is this bad?** Using an invalid atomic ordering
/// ### Why is this bad?
/// Using an invalid atomic ordering
/// will cause a panic at run-time.
///
/// **Known problems:** None.
///
/// **Example:**
/// ### Example
/// ```rust,no_run
/// # use std::sync::atomic::{self, AtomicU8, Ordering};
///
Expand Down
Loading

0 comments on commit 92ca25b

Please sign in to comment.