Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #130 from oppiliappan/maintenance

some maintenance

authored by

Shahar "Dawn" Or and committed by
GitHub
b34b8d2c c1328419

+77 -117
+1 -1
Cargo.toml
··· 3 3 members = ["bin", "lib", "macros", "vfs"] 4 4 5 5 [workspace.package] 6 - edition = "2018" 6 + edition = "2024" 7 7 license = "MIT" 8 8 9 9 [workspace.dependencies]
+1 -1
bin/Cargo.toml
··· 22 22 rayon.workspace = true 23 23 rnix.workspace = true 24 24 serde.workspace = true 25 - serde_json = { workspace = true, optional = true } 25 + serde_json = { optional = true, workspace = true } 26 26 similar.workspace = true 27 27 thiserror.workspace = true 28 28 toml.workspace = true
+4 -4
bin/src/config.rs
··· 5 5 str::FromStr, 6 6 }; 7 7 8 - use crate::{dirs, err::ConfigErr, utils, LintMap}; 8 + use crate::{LintMap, dirs, err::ConfigErr, utils}; 9 9 10 10 use clap::Parser; 11 - use lib::{session::Version, LINTS}; 11 + use lib::{LINTS, session::Version}; 12 12 use serde::{Deserialize, Serialize}; 13 13 use vfs::ReadOnlyVfs; 14 14 ··· 282 282 }; 283 283 if statix_toml_path.exists() { 284 284 return Self::from_path(statix_toml_path); 285 - }; 285 + } 286 286 } 287 287 Ok(Self::default()) 288 288 } ··· 362 362 vfs.set_file_contents(file, data.as_bytes()); 363 363 } else { 364 364 println!("`{}` contains non-utf8 content", file.display()); 365 - }; 365 + } 366 366 } 367 367 vfs 368 368 }
+1 -1
bin/src/dirs.rs
··· 7 7 use crate::dirs; 8 8 9 9 use ignore::{ 10 - gitignore::{Gitignore, GitignoreBuilder}, 11 10 Error as IgnoreError, Match, 11 + gitignore::{Gitignore, GitignoreBuilder}, 12 12 }; 13 13 14 14 #[derive(Debug)]
+2 -2
bin/src/fix.rs
··· 90 90 std::fs::write(path, &*fix_result.src).map_err(FixErr::InvalidPath)?; 91 91 } 92 92 _ => (), 93 - }; 93 + } 94 94 } 95 95 Ok(()) 96 96 } ··· 138 138 std::fs::write(path, &*single_result.src).map_err(FixErr::InvalidPath)?; 139 139 } 140 140 (_, Err(e)) => return Err(e.into()), 141 - }; 141 + } 142 142 Ok(()) 143 143 } 144 144 }
+3 -3
bin/src/fix/all.rs
··· 1 1 use std::borrow::Cow; 2 2 3 - use lib::{session::SessionInfo, Report}; 4 - use rnix::{parser::ParseError as RnixParseErr, WalkEvent}; 3 + use lib::{Report, session::SessionInfo}; 4 + use rnix::{WalkEvent, parser::ParseError as RnixParseErr}; 5 5 6 6 use crate::{ 7 + LintMap, 7 8 fix::{FixResult, Fixed}, 8 - LintMap, 9 9 }; 10 10 11 11 fn collect_fixes(
+1 -1
bin/src/fix/single.rs
··· 1 1 use std::{borrow::Cow, convert::TryFrom}; 2 2 3 - use lib::{session::SessionInfo, Report}; 3 + use lib::{Report, session::SessionInfo}; 4 4 use rnix::{TextSize, WalkEvent}; 5 5 6 6 use crate::{err::SingleFixErr, fix::Source, utils};
+2 -2
bin/src/lint.rs
··· 1 - use crate::{utils, LintMap}; 1 + use crate::{LintMap, utils}; 2 2 3 - use lib::{session::SessionInfo, Report}; 3 + use lib::{Report, session::SessionInfo}; 4 4 use rnix::WalkEvent; 5 5 use vfs::{FileId, VfsEntry}; 6 6
+2 -2
bin/src/main.rs
··· 7 7 lint, fix, explain, dump, list, 8 8 }; 9 9 10 - fn _main() -> Result<(), StatixErr> { 10 + fn main_() -> Result<(), StatixErr> { 11 11 let opts = Opts::parse(); 12 12 match opts.cmd { 13 13 SubCommand::Check(config) => lint::main::main(&config), ··· 20 20 } 21 21 22 22 fn main() { 23 - if let Err(e) = _main() { 23 + if let Err(e) = main_() { 24 24 eprintln!("{e}"); 25 25 } 26 26 }
+1 -1
bin/src/utils.rs
··· 1 1 use std::collections::HashMap; 2 2 3 - use lib::{Lint, LINTS}; 3 + use lib::{LINTS, Lint}; 4 4 use rnix::SyntaxKind; 5 5 6 6 #[allow(clippy::borrowed_box)]
+4 -2
flake-parts/ci.nix
··· 52 52 jobs = { 53 53 ${ids.jobs.getCheckNames} = { 54 54 runs-on = runner.name; 55 - outputs.${ids.outputs.jobs.getCheckNames} = "\${{ steps.${ids.steps.getCheckNames}.outputs.${ids.outputs.steps.getCheckNames} }}"; 55 + outputs.${ids.outputs.jobs.getCheckNames} = 56 + "\${{ steps.${ids.steps.getCheckNames}.outputs.${ids.outputs.steps.getCheckNames} }}"; 56 57 steps = [ 57 58 steps.checkout 58 59 steps.cachixInstallNix ··· 69 70 ${ids.jobs.check} = { 70 71 needs = ids.jobs.getCheckNames; 71 72 runs-on = runner.name; 72 - strategy.matrix.${matrixParam} = "\${{ fromJson(needs.${ids.jobs.getCheckNames}.outputs.${ids.outputs.jobs.getCheckNames}) }}"; 73 + strategy.matrix.${matrixParam} = 74 + "\${{ fromJson(needs.${ids.jobs.getCheckNames}.outputs.${ids.outputs.jobs.getCheckNames}) }}"; 73 75 steps = [ 74 76 steps.checkout 75 77 steps.cachixInstallNix
+6 -45
flake.lock
··· 1 1 { 2 2 "nodes": { 3 - "fenix": { 4 - "inputs": { 5 - "nixpkgs": [ 6 - "nixpkgs" 7 - ], 8 - "rust-analyzer-src": "rust-analyzer-src" 9 - }, 10 - "locked": { 11 - "lastModified": 1731738660, 12 - "narHash": "sha256-tIXhc9lX1b030v812yVJanSR37OnpTb/OY5rU3TbShA=", 13 - "owner": "nix-community", 14 - "repo": "fenix", 15 - "rev": "e10ba121773f754a30d31b6163919a3e404a434f", 16 - "type": "github" 17 - }, 18 - "original": { 19 - "owner": "nix-community", 20 - "repo": "fenix", 21 - "type": "github" 22 - } 23 - }, 24 3 "flake-parts": { 25 4 "inputs": { 26 5 "nixpkgs-lib": [ ··· 28 7 ] 29 8 }, 30 9 "locked": { 31 - "lastModified": 1751413152, 32 - "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", 10 + "lastModified": 1754487366, 11 + "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", 33 12 "owner": "hercules-ci", 34 13 "repo": "flake-parts", 35 - "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", 14 + "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", 36 15 "type": "github" 37 16 }, 38 17 "original": { ··· 43 22 }, 44 23 "nixpkgs": { 45 24 "locked": { 46 - "lastModified": 1731890469, 47 - "narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=", 25 + "lastModified": 1755268003, 26 + "narHash": "sha256-nNaeJjo861wFR0tjHDyCnHs1rbRtrMgxAKMoig9Sj/w=", 48 27 "owner": "nixos", 49 28 "repo": "nixpkgs", 50 - "rev": "5083ec887760adfe12af64830a66807423a859a7", 29 + "rev": "32f313e49e42f715491e1ea7b306a87c16fe0388", 51 30 "type": "github" 52 31 }, 53 32 "original": { ··· 59 38 }, 60 39 "root": { 61 40 "inputs": { 62 - "fenix": "fenix", 63 41 "flake-parts": "flake-parts", 64 42 "nixpkgs": "nixpkgs", 65 43 "systems": "systems" 66 - } 67 - }, 68 - "rust-analyzer-src": { 69 - "flake": false, 70 - "locked": { 71 - "lastModified": 1731693936, 72 - "narHash": "sha256-uHUUS1WPyW6ohp5Bt3dAZczUlQ22vOn7YZF8vaPKIEw=", 73 - "owner": "rust-lang", 74 - "repo": "rust-analyzer", 75 - "rev": "1b90e979aeee8d1db7fe14603a00834052505497", 76 - "type": "github" 77 - }, 78 - "original": { 79 - "owner": "rust-lang", 80 - "ref": "nightly", 81 - "repo": "rust-analyzer", 82 - "type": "github" 83 44 } 84 45 }, 85 46 "systems": {
-5
flake.nix
··· 5 5 }; 6 6 7 7 inputs = { 8 - fenix = { 9 - url = "github:nix-community/fenix"; 10 - inputs.nixpkgs.follows = "nixpkgs"; 11 - }; 12 - 13 8 flake-parts = { 14 9 url = "github:hercules-ci/flake-parts"; 15 10 inputs.nixpkgs-lib.follows = "nixpkgs";
+2 -2
lib/Cargo.toml
··· 12 12 macros.workspace = true 13 13 rnix.workspace = true 14 14 rowan.workspace = true 15 - serde = { workspace = true, optional = true } 16 - serde_json = { workspace = true, optional = true } 15 + serde = { optional = true, workspace = true } 16 + serde_json = { optional = true, workspace = true } 17 17 18 18 [features] 19 19 default = []
+2 -2
lib/src/lib.rs
··· 7 7 pub use lints::LINTS; 8 8 use session::SessionInfo; 9 9 10 - use rnix::{parser::ParseError, SyntaxElement, SyntaxKind, TextRange}; 10 + use rnix::{SyntaxElement, SyntaxKind, TextRange, parser::ParseError}; 11 11 use std::{convert::Into, default::Default}; 12 12 13 13 #[cfg(feature = "json-out")] 14 14 use serde::{ 15 - ser::{SerializeStruct, Serializer}, 16 15 Serialize, 16 + ser::{SerializeStruct, Serializer}, 17 17 }; 18 18 19 19 #[derive(Debug, Default)]
+2 -2
lib/src/lints/bool_comparison.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{BinOp, BinOpKind, Ident, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, 7 + types::{BinOp, BinOpKind, Ident, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/bool_simplification.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{BinOp, BinOpKind, Paren, TypedNode, UnaryOp, UnaryOpKind, Wrapper}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{BinOp, BinOpKind, Paren, TypedNode, UnaryOp, UnaryOpKind, Wrapper}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/collapsible_let_in.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{LetIn, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, TextRange, 7 + types::{LetIn, TypedNode}, 8 8 }; 9 9 use rowan::Direction; 10 10
+3 -3
lib/src/lints/deprecated_to_path.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule}; 1 + use crate::{Metadata, Report, Rule, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Apply, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Apply, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does ··· 46 46 if let NodeOrToken::Node(node) = node; 47 47 if let Some(apply) = Apply::cast(node.clone()); 48 48 let lambda_path = apply.lambda()?.to_string(); 49 - if ALLOWED_PATHS.iter().any(|&p| p == lambda_path.as_str()); 49 + if ALLOWED_PATHS.contains(&lambda_path.as_str()); 50 50 then { 51 51 let at = node.text_range(); 52 52 let message = format!("`{lambda_path}` is deprecated, see `:doc builtins.toPath` within the REPL for more");
+2 -2
lib/src/lints/empty_inherit.rs
··· 1 - use crate::{make, session::SessionInfo, utils, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo, utils}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Inherit, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Inherit, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/empty_let_in.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{EntryHolder, LetIn, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{EntryHolder, LetIn, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/empty_list_concat.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{BinOp, BinOpKind, List, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, 7 + types::{BinOp, BinOpKind, List, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/empty_pattern.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{AttrSet, EntryHolder, Lambda, Pattern, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, 7 + types::{AttrSet, EntryHolder, Lambda, Pattern, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/eta_reduction.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Apply, Ident, Lambda, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, 7 + types::{Apply, Ident, Lambda, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/legacy_let_syntax.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{EntryHolder, Ident, Key, LegacyLet, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{EntryHolder, Ident, Key, LegacyLet, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/manual_inherit.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Ident, KeyValue, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Ident, KeyValue, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/manual_inherit_from.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Ident, KeyValue, Select, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Ident, KeyValue, Select, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/redundant_pattern_bind.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Pattern, TokenWrapper, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Pattern, TokenWrapper, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+5 -3
lib/src/lints/repeated_keys.rs
··· 1 - use crate::{session::SessionInfo, Metadata, Report, Rule}; 1 + use std::fmt::Write as _; 2 + 3 + use crate::{Metadata, Report, Rule, session::SessionInfo}; 2 4 3 5 use if_chain::if_chain; 4 6 use macros::lint; 5 7 use rnix::{ 6 - types::{AttrSet, EntryHolder, Ident, KeyValue, TokenWrapper, TypedNode}, 7 8 NodeOrToken, SyntaxElement, SyntaxKind, 9 + types::{AttrSet, EntryHolder, Ident, KeyValue, TokenWrapper, TypedNode}, 8 10 }; 9 11 10 12 /// ## What it does ··· 96 98 1 => "... and here (`1` occurrence omitted).".to_string(), 97 99 n => format!("... and here (`{n}` occurrences omitted)."), 98 100 }; 99 - message.push_str(&format!(" Try `{} = {{ {}=...; {}=...; {}=...; }}` instead.", first_component_ident.as_str(), first_subkey, second_subkey, third_subkey)); 101 + write!(message, " Try `{} = {{ {}=...; {}=...; {}=...; }}` instead.", first_component_ident.as_str(), first_subkey, second_subkey, third_subkey).unwrap(); 100 102 message 101 103 }; 102 104
+2 -2
lib/src/lints/unquoted_splice.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{Dynamic, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{Dynamic, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/unquoted_uri.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 - use rnix::{types::TypedNode, NodeOrToken, SyntaxElement, SyntaxKind}; 5 + use rnix::{NodeOrToken, SyntaxElement, SyntaxKind, types::TypedNode}; 6 6 7 7 /// ## What it does 8 8 /// Checks for URI expressions that are not quoted.
+2 -2
lib/src/lints/useless_has_attr.rs
··· 1 - use crate::{make, session::SessionInfo, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Metadata, Report, Rule, Suggestion, make, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{BinOp, BinOpKind, IfElse, Select, TypedNode}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{BinOp, BinOpKind, IfElse, Select, TypedNode}, 8 8 }; 9 9 10 10 /// ## What it does
+2 -2
lib/src/lints/useless_parens.rs
··· 1 - use crate::{session::SessionInfo, Diagnostic, Metadata, Report, Rule, Suggestion}; 1 + use crate::{Diagnostic, Metadata, Report, Rule, Suggestion, session::SessionInfo}; 2 2 3 3 use if_chain::if_chain; 4 4 use macros::lint; 5 5 use rnix::{ 6 - types::{KeyValue, LetIn, Paren, ParsedType, TypedNode, Wrapper}, 7 6 NodeOrToken, SyntaxElement, SyntaxKind, 7 + types::{KeyValue, LetIn, Paren, ParsedType, TypedNode, Wrapper}, 8 8 }; 9 9 10 10 /// ## What it does
+1 -1
lib/src/make.rs
··· 1 1 use std::{fmt::Write, iter::IntoIterator}; 2 2 3 3 use rnix::{ 4 - types::{self, TokenWrapper, TypedNode}, 5 4 SyntaxNode, 5 + types::{self, TokenWrapper, TypedNode}, 6 6 }; 7 7 8 8 fn ast_from_text<N: TypedNode>(text: &str) -> N {
+2 -2
macros/src/lib.rs
··· 2 2 mod metadata; 3 3 4 4 use explain::generate_explain_impl; 5 - use metadata::{generate_meta_impl, RawLintMeta}; 5 + use metadata::{RawLintMeta, generate_meta_impl}; 6 6 use proc_macro::TokenStream; 7 7 use proc_macro2::TokenStream as TokenStream2; 8 8 use quote::quote; 9 - use syn::{parse_macro_input, Ident, ItemStruct}; 9 + use syn::{Ident, ItemStruct, parse_macro_input}; 10 10 11 11 fn generate_self_impl(struct_name: &Ident) -> TokenStream2 { 12 12 quote! {
+2 -2
macros/src/metadata.rs
··· 3 3 use proc_macro2::TokenStream as TokenStream2; 4 4 use quote::{format_ident, quote}; 5 5 use syn::{ 6 + Expr, ExprArray, Ident, Lit, Path, Token, 6 7 parse::{Parse, ParseStream, Result}, 7 8 punctuated::Punctuated, 8 - Expr, ExprArray, Ident, Lit, Path, Token, 9 9 }; 10 10 11 11 struct KeyValue { ··· 52 52 fn extract<'λ>(id: &str, raw: &'λ RawLintMeta) -> &'λ Expr { 53 53 raw.0 54 54 .get(&format_ident!("{}", id)) 55 - .unwrap_or_else(|| panic!("`{}` not present", id)) 55 + .unwrap_or_else(|| panic!("`{id}` not present")) 56 56 } 57 57 58 58 fn as_lit(e: &Expr) -> &Lit {