Revert "Upgrade to Rust 1.82 toolchain" (#13810)

This commit is contained in:
Micha Reiser 2024-10-18 14:18:26 +02:00 committed by GitHub
parent ff72055558
commit 6d7da7bdbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 51 additions and 55 deletions

View file

@ -193,7 +193,7 @@ jobs:
run: rustup target add wasm32-unknown-unknown run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 18
cache: "npm" cache: "npm"
cache-dependency-path: playground/package-lock.json cache-dependency-path: playground/package-lock.json
- uses: jetli/wasm-pack-action@v0.4.0 - uses: jetli/wasm-pack-action@v0.4.0

View file

@ -29,7 +29,7 @@ jobs:
run: rustup target add wasm32-unknown-unknown run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 18
cache: "npm" cache: "npm"
cache-dependency-path: playground/package-lock.json cache-dependency-path: playground/package-lock.json
- uses: jetli/wasm-pack-action@v0.4.0 - uses: jetli/wasm-pack-action@v0.4.0

View file

@ -43,7 +43,7 @@ jobs:
- run: cp LICENSE crates/ruff_wasm/pkg # wasm-pack does not put the LICENSE file in the pkg - run: cp LICENSE crates/ruff_wasm/pkg # wasm-pack does not put the LICENSE file in the pkg
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 18
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
- name: "Publish (dry-run)" - name: "Publish (dry-run)"
if: ${{ inputs.plan == '' || fromJson(inputs.plan).announcement_tag_is_implicit }} if: ${{ inputs.plan == '' || fromJson(inputs.plan).announcement_tag_is_implicit }}

View file

@ -1,7 +1,6 @@
//! Scheduling, I/O, and API endpoints. //! Scheduling, I/O, and API endpoints.
use std::num::NonZeroUsize; use std::num::NonZeroUsize;
#[allow(deprecated)]
use std::panic::PanicInfo; use std::panic::PanicInfo;
use lsp_server::Message; use lsp_server::Message;
@ -120,7 +119,6 @@ impl Server {
} }
pub(crate) fn run(self) -> crate::Result<()> { pub(crate) fn run(self) -> crate::Result<()> {
#[allow(deprecated)]
type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>; type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>;
struct RestorePanicHook { struct RestorePanicHook {
hook: Option<PanicHook>, hook: Option<PanicHook>,

View file

@ -235,7 +235,8 @@ fn clean_params_dictionary(right: &Expr, locator: &Locator, stylist: &Stylist) -
let mut seen: Vec<&str> = vec![]; let mut seen: Vec<&str> = vec![];
let mut indent = None; let mut indent = None;
for ast::DictItem { key, value } in items { for ast::DictItem { key, value } in items {
if let Some(key) = key { match key {
Some(key) => {
if let Expr::StringLiteral(ast::ExprStringLiteral { if let Expr::StringLiteral(ast::ExprStringLiteral {
value: key_string, .. value: key_string, ..
}) = key }) = key
@ -261,11 +262,13 @@ fn clean_params_dictionary(right: &Expr, locator: &Locator, stylist: &Stylist) -
// If there are any non-string keys, abort. // If there are any non-string keys, abort.
return None; return None;
} }
} else { }
None => {
let value_string = locator.slice(value); let value_string = locator.slice(value);
arguments.push(format!("**{value_string}")); arguments.push(format!("**{value_string}"));
} }
} }
}
// If we couldn't parse out key values, abort. // If we couldn't parse out key values, abort.
if arguments.is_empty() { if arguments.is_empty() {
return None; return None;

View file

@ -75,11 +75,12 @@ pub(crate) fn derive_cache_key(item: &DeriveInput) -> syn::Result<TokenStream> {
} }
} }
let field_attr = if let Some(ident) = &field.ident { let field_attr = match &field.ident {
quote!(self.#ident) Some(ident) => quote!(self.#ident),
} else { None => {
let index = syn::Index::from(i); let index = syn::Index::from(i);
quote!(self.#index) quote!(self.#index)
}
}; };
fields.push(quote!(#field_attr.cache_key(key);)); fields.push(quote!(#field_attr.cache_key(key);));

View file

@ -143,10 +143,9 @@ pub(crate) fn map_codes(func: &ItemFn) -> syn::Result<TokenStream> {
for (prefix, rules) in &rules_by_prefix { for (prefix, rules) in &rules_by_prefix {
let prefix_ident = get_prefix_ident(prefix); let prefix_ident = get_prefix_ident(prefix);
let attrs = intersection_all(rules.iter().map(|(.., attrs)| attrs.as_slice())); let attrs = intersection_all(rules.iter().map(|(.., attrs)| attrs.as_slice()));
let attrs = if attrs.is_empty() { let attrs = match attrs.as_slice() {
quote!() [] => quote!(),
} else { [..] => quote!(#(#attrs)*),
quote!(#(#attrs)*)
}; };
all_codes.push(quote! { all_codes.push(quote! {
#attrs Self::#linter(#linter::#prefix_ident) #attrs Self::#linter(#linter::#prefix_ident)
@ -162,10 +161,9 @@ pub(crate) fn map_codes(func: &ItemFn) -> syn::Result<TokenStream> {
}); });
let prefix_ident = get_prefix_ident(&prefix); let prefix_ident = get_prefix_ident(&prefix);
let attrs = intersection_all(rules.iter().map(|(.., attrs)| attrs.as_slice())); let attrs = intersection_all(rules.iter().map(|(.., attrs)| attrs.as_slice()));
let attrs = if attrs.is_empty() { let attrs = match attrs.as_slice() {
quote!() [] => quote!(),
} else { [..] => quote!(#(#attrs)*),
quote!(#(#attrs)*)
}; };
prefix_into_iter_match_arms.extend(quote! { prefix_into_iter_match_arms.extend(quote! {
#attrs #linter::#prefix_ident => vec![#(#rule_paths,)*].into_iter(), #attrs #linter::#prefix_ident => vec![#(#rule_paths,)*].into_iter(),

View file

@ -90,10 +90,9 @@ fn attributes_for_prefix(
attributes: &BTreeMap<String, &[Attribute]>, attributes: &BTreeMap<String, &[Attribute]>,
) -> proc_macro2::TokenStream { ) -> proc_macro2::TokenStream {
let attrs = intersection_all(codes.iter().map(|code| attributes[code])); let attrs = intersection_all(codes.iter().map(|code| attributes[code]));
if attrs.is_empty() { match attrs.as_slice() {
quote!() [] => quote!(),
} else { [..] => quote!(#(#attrs)*),
quote!(#(#attrs)*)
} }
} }

View file

@ -18,10 +18,9 @@ impl FormatNodeRule<PatternMatchStar> for FormatPatternMatchStar {
write!(f, [token("*"), dangling_comments(dangling)])?; write!(f, [token("*"), dangling_comments(dangling)])?;
if let Some(name) = name { match name {
write!(f, [name.format()]) Some(name) => write!(f, [name.format()]),
} else { None => write!(f, [token("_")]),
write!(f, [token("_")])
} }
} }
} }

View file

@ -6,7 +6,6 @@ use lsp_types::InitializeParams;
use lsp_types::WorkspaceFolder; use lsp_types::WorkspaceFolder;
use std::num::NonZeroUsize; use std::num::NonZeroUsize;
use std::ops::Deref; use std::ops::Deref;
#[allow(deprecated)]
use std::panic::PanicInfo; use std::panic::PanicInfo;
use std::str::FromStr; use std::str::FromStr;
use thiserror::Error; use thiserror::Error;
@ -126,7 +125,6 @@ impl Server {
} }
pub fn run(self) -> crate::Result<()> { pub fn run(self) -> crate::Result<()> {
#[allow(deprecated)]
type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>; type PanicHook = Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>;
struct RestorePanicHook { struct RestorePanicHook {
hook: Option<PanicHook>, hook: Option<PanicHook>,

View file

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.82" channel = "1.81"