Skip to content

Commit d260410

Browse files
authored
Merge branch 'rust-lang:master' into master
2 parents 0321e39 + 3d7188d commit d260410

File tree

76 files changed

+661
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+661
-398
lines changed

.github/workflows/feature_freeze.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,26 @@ jobs:
2020
# of the pull request, as malicious code would be able to access the private
2121
# GitHub token.
2222
steps:
23-
- name: Check PR Changes
24-
id: pr-changes
25-
run: echo "::set-output name=changes::${{ toJson(github.event.pull_request.changed_files) }}"
26-
27-
- name: Create Comment
28-
if: steps.pr-changes.outputs.changes != '[]'
29-
run: |
30-
# Use GitHub API to create a comment on the PR
31-
PR_NUMBER=${{ github.event.pull_request.number }}
32-
COMMENT="**Seems that you are trying to add a new lint!**\nWe are currently in a [feature freeze](https://doc.rust-lang.org/nightly/clippy/development/feature_freeze.html), so we are delaying all lint-adding PRs to September 18 and focusing on bugfixes.\nThanks a lot for your contribution, and sorry for the inconvenience.\nWith ❤ from the Clippy team\n\n@rustbot note Feature-freeze\n@rustbot blocked\n@rustbot label +A-lint\n"
33-
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
34-
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
35-
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"
23+
- name: Add freeze warning comment
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITHUB_REPOSITORY: ${{ github.repository }}
27+
PR_NUMBER: ${{ github.event.pull_request.number }}
28+
run: |
29+
COMMENT=$(echo "**Seems that you are trying to add a new lint!**\n\
30+
\n\
31+
We are currently in a [feature freeze](https://doc.rust-lang.org/nightly/clippy/development/feature_freeze.html), so we are delaying all lint-adding PRs to September 18 and [focusing on bugfixes](https://github.com/rust-lang/rust-clippy/issues/15086).\n\
32+
\n\
33+
Thanks a lot for your contribution, and sorry for the inconvenience.\n\
34+
\n\
35+
With ❤ from the Clippy team.\n\
36+
\n\
37+
@rustbot note Feature-freeze\n\
38+
@rustbot blocked\n\
39+
@rustbot label +A-lint"
40+
)
41+
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
42+
-H "Content-Type: application/vnd.github.raw+json" \
43+
-X POST \
44+
--data "{\"body\":\"${COMMENT}\"}" \
45+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments"

clippy_dev/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
rustc_private,
33
exit_status_error,
44
if_let_guard,
5-
let_chains,
65
os_str_slice,
76
os_string_truncate,
87
slice_split_once

clippy_lints/src/approx_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl ApproxConstant {
7474
}
7575

7676
impl LateLintPass<'_> for ApproxConstant {
77-
fn check_lit(&mut self, cx: &LateContext<'_>, _hir_id: HirId, lit: &Lit, _negated: bool) {
77+
fn check_lit(&mut self, cx: &LateContext<'_>, _hir_id: HirId, lit: Lit, _negated: bool) {
7878
match lit.node {
7979
LitKind::Float(s, LitFloatType::Suffixed(fty)) => match fty {
8080
FloatTy::F16 => self.check_known_consts(cx, lit.span, s, "f16"),

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
266266
.tcx
267267
.hir_attrs(item.hir_id())
268268
.iter()
269-
.any(|attr| matches!(attr, Attribute::Parsed(AttributeKind::Repr(..))))
269+
.any(|attr| matches!(attr, Attribute::Parsed(AttributeKind::Repr { .. })))
270270
{
271271
// Do not lint items with a `#[repr]` attribute as their layout may be imposed by an external API.
272272
return;

clippy_lints/src/attrs/repr_attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use clippy_utils::msrvs::{self, Msrv};
99
use super::REPR_PACKED_WITHOUT_ABI;
1010

1111
pub(super) fn check(cx: &LateContext<'_>, item_span: Span, attrs: &[Attribute], msrv: Msrv) {
12-
if let Some(reprs) = find_attr!(attrs, AttributeKind::Repr(r) => r) {
12+
if let Some(reprs) = find_attr!(attrs, AttributeKind::Repr { reprs, .. } => reprs) {
1313
let packed_span = reprs
1414
.iter()
1515
.find(|(r, _)| matches!(r, ReprAttr::ReprPacked(..)))

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn extract_bool_lit(e: &Expr<'_>) -> Option<bool> {
4242
}) = e.kind
4343
&& !e.span.from_expansion()
4444
{
45-
Some(*b)
45+
Some(b)
4646
} else {
4747
None
4848
}

clippy_lints/src/casts/fn_to_numeric_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1717
ty::FnDef(..) | ty::FnPtr(..) => {
1818
let mut applicability = Applicability::MaybeIncorrect;
1919

20-
if to_nbits >= cx.tcx.data_layout.pointer_size.bits() && !cast_to.is_usize() {
20+
if to_nbits >= cx.tcx.data_layout.pointer_size().bits() && !cast_to.is_usize() {
2121
let from_snippet = snippet_with_applicability(cx, cast_expr.span, "x", &mut applicability);
2222
span_lint_and_sugg(
2323
cx,

clippy_lints/src/casts/fn_to_numeric_cast_with_truncation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1717
let mut applicability = Applicability::MaybeIncorrect;
1818
let from_snippet = snippet_with_applicability(cx, cast_expr.span, "x", &mut applicability);
1919

20-
if to_nbits < cx.tcx.data_layout.pointer_size.bits() {
20+
if to_nbits < cx.tcx.data_layout.pointer_size().bits() {
2121
span_lint_and_sugg(
2222
cx,
2323
FN_TO_NUMERIC_CAST_WITH_TRUNCATION,

clippy_lints/src/casts/manual_dangling_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, from: &Expr<'_>, to:
4646
fn is_expr_const_aligned(cx: &LateContext<'_>, expr: &Expr<'_>, to: &Ty<'_>) -> bool {
4747
match expr.kind {
4848
ExprKind::Call(fun, _) => is_align_of_call(cx, fun, to),
49-
ExprKind::Lit(lit) => is_literal_aligned(cx, lit, to),
49+
ExprKind::Lit(lit) => is_literal_aligned(cx, &lit, to),
5050
_ => false,
5151
}
5252
}

clippy_lints/src/casts/unnecessary_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn lint_unnecessary_cast(
243243
);
244244
}
245245

246-
fn get_numeric_literal<'e>(expr: &'e Expr<'e>) -> Option<&'e Lit> {
246+
fn get_numeric_literal<'e>(expr: &'e Expr<'e>) -> Option<Lit> {
247247
match expr.kind {
248248
ExprKind::Lit(lit) => Some(lit),
249249
ExprKind::Unary(UnOp::Neg, e) => {

0 commit comments

Comments
 (0)