- 
                Notifications
    You must be signed in to change notification settings 
- Fork 32
          Update linter to toolchain nightly-2025-05-14
          #456
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
976b6fc
              842f0a7
              e12d9ee
              6d078d7
              a8bfcc8
              44671e2
              ad772a0
              0a3cddb
              18eda6e
              f6b0645
              3a08528
              87582dc
              b6bbd58
              a20598f
              29eac19
              a2b2a95
              d35b2f7
              faff0ce
              c6c4aea
              35f57d0
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -16,6 +16,8 @@ | |
| #![feature(rustc_private)] | ||
| // Allows chaining `if let` multiple times using `&&`. | ||
| #![feature(let_chains)] | ||
|         
                  DaAlbrecht marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| // Used to access the index of repeating macro input in `declare_bevy_symbols!`. | ||
| #![feature(macro_metavar_expr)] | ||
| 
      Comment on lines
    
      +19
     to 
      +20
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The RFC for this feature is really interesting! It lets us do this kind of thing: #[macro_export]
macro_rules! vec {
    ( $( $x:expr ),* ) => {
        {
            // `${count(x)}` counts the amount of times `$x` is specified, and evaluates to that number!
            // We can't do this in stable Rust without proc-macros, which can be quite slow.
            let mut temp_vec = Vec::with_capacity(${count(x)});
            $(
                temp_vec.push($x);
            )*
            temp_vec
        }
    };
}In the linter I use  | ||
| // Warn on internal `rustc` lints that check for poor usage of internal compiler APIs. Note that | ||
| // you also need to pass `-Z unstable-options` to `rustc` for this to be enabled: | ||
| // `RUSTFLAGS="-Zunstable-options" cargo check` | ||
|  | @@ -40,12 +42,14 @@ extern crate rustc_lint_defs; | |
| extern crate rustc_middle; | ||
| extern crate rustc_session; | ||
| extern crate rustc_span; | ||
| extern crate rustc_type_ir; | ||
|  | ||
| mod callback; | ||
| mod config; | ||
| mod lint; | ||
| pub mod lints; | ||
| mod paths; | ||
| mod sym; | ||
| mod utils; | ||
|  | ||
| pub use self::callback::BevyLintCallback; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -148,13 +148,6 @@ macro_rules! declare_bevy_lint { | |
| /// declare_bevy_lint_pass! { | ||
| /// // Declares which lints are emitted by this lint pass. | ||
| /// pub LintPassName => [LINT_NAME], | ||
| /// | ||
| /// // The following are optional fields, and may be omitted. | ||
| /// // | ||
| /// // Declares fields of the lint pass that are set when `LintPassName::default()` is called. | ||
| /// @default = { | ||
| /// component: Symbol = Symbol::intern("component"), | ||
| /// }, | ||
| /// } | ||
| /// ``` | ||
| #[macro_export] | ||
|  | @@ -163,25 +156,9 @@ macro_rules! declare_bevy_lint_pass { | |
| ( | ||
| $(#[$attr:meta])* | ||
| $vis:vis $name:ident => [$($lint:expr),* $(,)?], | ||
|  | ||
| $( | ||
| @default = { | ||
| $($default_field:ident: $default_ty:ty = $default_value:expr),* $(,)? | ||
| }, | ||
| )? | ||
| 
      Comment on lines
    
      -167
     to 
      -171
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We no longer need  | ||
| ) => { | ||
| $(#[$attr])* | ||
| $vis struct $name { | ||
| $($($default_field: $default_ty),*)? | ||
| } | ||
|  | ||
| impl ::std::default::Default for $name { | ||
| fn default() -> Self { | ||
| Self { | ||
| $($($default_field: $default_value),*)? | ||
| } | ||
| } | ||
| } | ||
| 
      Comment on lines
    
      -178
     to 
      -184
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We no longer implement  | ||
| $vis struct $name; | ||
|  | ||
| ::rustc_lint_defs::impl_lint_pass!($name => [$($lint),*]); | ||
| }; | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI will fail testing this action because it's trying to install the linter from the
mainbranch, notrust-2025-05-14. This is a shortcoming of CI, and can be safely ignored!