From 07aef8d89d66260b2be7220a76b5c1ef7f817c62 Mon Sep 17 00:00:00 2001 From: Jonatan Waern Date: Tue, 10 Mar 2026 14:12:11 +0100 Subject: [PATCH 1/3] Update subprocess to 1.0 Signed-off-by: Jonatan Waern --- Cargo.toml | 2 +- src/dfa/client.rs | 16 +++++++--------- src/dfa/main.rs | 8 +++----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 018da7e..4ccb5f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ serde_json = "1.0" slotmap = "1.0" store-interval-tree = "0.4" strum = { version = "0.28", features = ["derive"] } -subprocess = "=0.2.9" +subprocess = "1.0" thiserror = "2.0" urlencoding = "2.1" utf8-read = "0.4" diff --git a/src/dfa/client.rs b/src/dfa/client.rs index b404ee1..054eab5 100644 --- a/src/dfa/client.rs +++ b/src/dfa/client.rs @@ -21,7 +21,7 @@ use lsp_types::{self, notification, PublishDiagnosticsParams, ProgressParams, ProgressParamsValue, ProgressToken, WorkDoneProgress}; -use subprocess::{ExitStatus, Popen, PopenConfig, Redirection}; +use subprocess::{ExitStatus, Exec, Job, Redirection}; use crate::config::Config; use crate::server::{self, Notification}; @@ -97,7 +97,7 @@ impl RpcErrorKind { } pub struct ClientInterface { - server: Popen, + server: Job, reader: channel::Receiver, _reading_thread: JoinHandle<()>, diagnostics: HashMap>, @@ -114,13 +114,11 @@ impl ClientInterface { binary.to_str().unwrap(), wd.to_str().unwrap()); - let mut server = Popen::create(&[binary], - PopenConfig { - stdin: Redirection::Pipe, - stdout: Redirection::Pipe, - stderr: Redirection::None, - ..Default::default() - })?; + let mut server = Exec::cmd(binary) + .stdout(Redirection::Pipe) + .stdin(Redirection::Pipe) + .stderr(Redirection::None) + .start()?; let (sender, receiver) = channel::unbounded(); let child_stdout = server.stdout.take().unwrap(); let reading_thread = thread::spawn(move || { diff --git a/src/dfa/main.rs b/src/dfa/main.rs index f373cd9..171f57f 100644 --- a/src/dfa/main.rs +++ b/src/dfa/main.rs @@ -169,11 +169,9 @@ fn main_inner() -> Result<(), i32> { } dlsclient.wait_for_analysis().map_err( - |e|match e { - ExitStatus::Exited(u) => u.try_into().unwrap(), - ExitStatus::Signaled(u) => u.into(), - ExitStatus::Other(i) => i, - ExitStatus::Undetermined => -1, + |e|match e.code() { + Some(code) => code as i32, + None => -1, })?; if !arg.quiet { From 8312bf0a92e0d5f73f6b5149c3a66a70bc70e0dc Mon Sep 17 00:00:00 2001 From: Jonatan Waern Date: Tue, 10 Mar 2026 14:46:22 +0100 Subject: [PATCH 2/3] Clear some clippy warnings Signed-off-by: Jonatan Waern --- src/actions/analysis_storage.rs | 27 ++++++++++------------- src/actions/mod.rs | 6 +++--- src/actions/notifications.rs | 2 +- src/actions/semantic_lookup.rs | 2 +- src/analysis/mod.rs | 8 +++---- src/analysis/parsing/expression.rs | 20 ++++++++--------- src/analysis/parsing/misc.rs | 4 ++-- src/analysis/parsing/statement.rs | 33 +++++++++++++++-------------- src/analysis/parsing/structure.rs | 6 +++--- src/analysis/parsing/types.rs | 10 ++++----- src/analysis/structure/objects.rs | 2 +- src/analysis/symbols.rs | 1 + src/analysis/templating/objects.rs | 8 +++---- src/analysis/templating/topology.rs | 3 +-- src/dfa/main.rs | 3 --- src/lsp_data.rs | 6 +++--- src/main.rs | 2 +- src/server/mod.rs | 4 ++-- 18 files changed, 69 insertions(+), 78 deletions(-) diff --git a/src/actions/analysis_storage.rs b/src/actions/analysis_storage.rs index 5f5b6ed..90a2df6 100644 --- a/src/actions/analysis_storage.rs +++ b/src/actions/analysis_storage.rs @@ -178,8 +178,7 @@ impl AnalysisStorage { self.device_triggers.get(path) .map(|triggers|triggers.iter() .filter( - |p|filter.map_or( - true, + |p|filter.is_none_or( |f|f.contains(&ContextDefinition::Device((*p).clone())))) .filter_map(|p|self.get_device_analysis(p).ok()) .collect()) @@ -286,8 +285,7 @@ impl AnalysisStorage { trace!("Full contexts for {:?} are {:?}", path, contexts); - if self.get_isolated_analysis(path).map_or( - false, |a|a.is_device_file()) { + if self.get_isolated_analysis(path).is_ok_and(|a|a.is_device_file()) { contexts.insert(Some(path.clone())); } @@ -316,7 +314,7 @@ impl AnalysisStorage { let mut target_devices: Vec = vec![]; if self.get_isolated_analysis(path) - .map_or(false, |a|a.is_device_file()) { + .is_ok_and(|a|a.is_device_file()) { target_devices.push(path.clone()); } else { // Remove ourselves from the trigee list of any file @@ -325,7 +323,7 @@ impl AnalysisStorage { self.device_triggers.get_mut(trigger_path) .map(|e|e.remove(path)); if self.device_triggers.get(trigger_path) - .map_or(false, |e|e.is_empty()) { + .is_some_and(|e|e.is_empty()) { self.device_triggers.remove(trigger_path); } } @@ -483,13 +481,11 @@ impl AnalysisStorage { let canon_path = analysis.path.clone(); trace!("Handling isolated analysis on {}", canon_path.as_str()); - if self.isolated_analysis.get(&canon_path).map_or( - true, + if self.isolated_analysis.get(&canon_path).is_none_or( |prev| timestamp_is_newer(timestamp, prev.timestamp)) { trace!("invalidators are {:?}", self.invalidators); - if self.invalidators.get(&canon_path).map_or( - true, |invalid| timestamp_is_newer(timestamp, - *invalid)) { + if self.invalidators.get(&canon_path).is_none_or( + |invalid| timestamp_is_newer(timestamp, *invalid)) { trace!("was new, or fresh compared to previous"); dependencies_to_update.insert(canon_path.clone()); self.isolated_analysis.insert(canon_path.clone(), @@ -530,9 +526,8 @@ impl AnalysisStorage { if let AnalysisResult::Device(analysis) = analysisresult.stored { let canon_path = analysis.path.clone(); trace!("Handling device analysis on {}", canon_path.as_str()); - if self.device_analysis.get(&canon_path).map_or( - true, |prev| timestamp_is_newer(timestamp, - prev.timestamp)) { + if self.device_analysis.get(&canon_path).is_none_or( + |prev| timestamp_is_newer(timestamp, prev.timestamp)) { trace!("was new, or fresh compared to previous"); // This should be guaranteed let invalidators = self.all_dependencies( @@ -581,7 +576,7 @@ impl AnalysisStorage { for path in self.last_use.keys().cloned().collect::>() { if now.duration_since(*self.last_use.get(&path) .unwrap().lock().unwrap()) - .map_or(false, |duration|duration > max_age) { + .is_ok_and(|duration|duration > max_age) { info!("Discarded analysis of {} due to it being \ unused for too long.", path.as_str()); self.mark_file_dirty(&path); @@ -704,7 +699,7 @@ impl AnalysisStorage { .extend(self.gather_linter_errors(file).into_iter()); // Only report device errors if this analysis context is active - if filter.map_or(true, |f|f.contains(&file.clone().into())) { + if filter.is_none_or(|f|f.contains(&file.clone().into())) { for (dfile, errors) in self.gather_device_errors(file) { device_errors.entry(dfile.clone()) .or_default() diff --git a/src/actions/mod.rs b/src/actions/mod.rs index ed91df5..5875a69 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -465,8 +465,8 @@ impl InitActionContext { if !workspaces.is_empty() && !workspaces.iter().any( |root|parse_file_path!(&root.uri, "workspace") - .map_or(false, |p|canon_path.as_path() - .starts_with(p))) { + .is_ok_and(|p|canon_path.as_path() + .starts_with(p))) { crate::server::warning_message( out, "Compilation info file is not under \ @@ -1435,7 +1435,7 @@ impl FileWatch { fn relevant_change_kind(&self, change_uri: &Uri, _kind: FileChangeType) -> bool { let path = change_uri.as_str(); - self.file_path.to_str().map_or(false, |fp|fp == path) + self.file_path.to_str().is_some_and(|fp|fp == path) } #[inline] diff --git a/src/actions/notifications.rs b/src/actions/notifications.rs index d66a0be..c03c20e 100644 --- a/src/actions/notifications.rs +++ b/src/actions/notifications.rs @@ -183,7 +183,7 @@ impl BlockingNotificationAction for DidChangeConfiguration { debug!("config change: {:?}", params.settings); // New style config update, send re-config request if params.settings.is_null() || params.settings.as_object(). - map_or(false, |o|o.is_empty()) { + is_some_and(|o|o.is_empty()) { let config_params = lsp_types::ConfigurationParams { items: vec![lsp_types::ConfigurationItem { scope_uri: None, diff --git a/src/actions/semantic_lookup.rs b/src/actions/semantic_lookup.rs index 413d7a6..c3afa15 100644 --- a/src/actions/semantic_lookup.rs +++ b/src/actions/semantic_lookup.rs @@ -200,7 +200,7 @@ fn get_symbols_of_ref<'t>(reference: &Reference, if device.templates.templates.get(sym.name_ref()) .and_then(|t|t.location.as_ref()) .and_then(|loc|device.template_object_implementation_map.get(loc)) - .map_or(false, |impls|!impls.is_empty()) { + .is_some_and(|impls|!impls.is_empty()) { any_template_used = true; } } diff --git a/src/analysis/mod.rs b/src/analysis/mod.rs index 4ae3356..fcf8fb1 100644 --- a/src/analysis/mod.rs +++ b/src/analysis/mod.rs @@ -734,7 +734,7 @@ impl DeviceAnalysis { if let Some(found_obj) = curr_obj.get_object(sym.name_ref()) { if found_obj.resolve(&self.objects).as_shallow() - .map_or(false, |s|matches!( + .is_some_and(|s|matches!( &s.variant, DMLShallowObjectVariant::Method(_))) { vec![found_obj.clone()] @@ -1009,7 +1009,7 @@ impl DeviceAnalysis { sym: &SimpleSymbol, ref_matches: &mut ReferenceMatches) { let resolved = obj.resolve(&self.objects); - if resolved.as_comp().map_or(false, |c|c.kind == CompObjectKind::Device) + if resolved.as_comp().is_some_and(|c|c.kind == CompObjectKind::Device) && sym.kind == DMLSymbolKind::Template { self.lookup_global_symbol(sym, ref_matches); } else { @@ -1656,8 +1656,8 @@ impl IsolatedAnalysis { &mut errors, filespec); status.assert_alive(); // sanity, clientpath and path should be the same file - if CanonPath::from_path_buf(clientpath.clone()).map_or( - true, |cp|&cp != path) { + if CanonPath::from_path_buf(clientpath.clone()).is_none_or( + |cp|&cp != path) { error!("Clientpath did not describe the same \ file as the actual path; {:?} vs {:?}", path, diff --git a/src/analysis/parsing/expression.rs b/src/analysis/parsing/expression.rs index 8d8f0b6..9df617b 100644 --- a/src/analysis/parsing/expression.rs +++ b/src/analysis/parsing/expression.rs @@ -830,8 +830,8 @@ fn maybe_parse_extended_expression(preset_left: Option, let mut new_context = context.enter_context(understands_continuations); let mut left = parse_expression_inner( preset_left, &new_context, stream, file_info); - while new_context.peek_kind(stream).map_or( - false, |k|understands_continuations(k)) { + while new_context.peek_kind(stream).is_some_and( + |k|understands_continuations(k)) { match new_context.peek_kind(stream) { Some(TokenKind::LParen) => left = parse_function_call( left, &new_context, stream, file_info), @@ -872,7 +872,7 @@ fn maybe_parse_muldivmod_expression(preset_left: Option, let mut left = maybe_parse_extended_expression(preset_left, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_muldivmods) { + if new_context.peek_kind(stream).is_some_and(understands_muldivmods) { let operation = new_context.next_leaf(stream); let right = maybe_parse_muldivmod_expression(None, context, @@ -897,7 +897,7 @@ fn maybe_parse_addsub_expression(preset_left: Option, let mut left = maybe_parse_muldivmod_expression(preset_left, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_addsubs) { + if new_context.peek_kind(stream).is_some_and(understands_addsubs) { let operation = new_context.next_leaf(stream); let right = maybe_parse_addsub_expression(None, context, @@ -922,7 +922,7 @@ fn maybe_parse_shift_expression(preset_left: Option, let mut left = maybe_parse_addsub_expression(preset_left, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_shifts) { + if new_context.peek_kind(stream).is_some_and(understands_shifts) { let operation = new_context.next_leaf(stream); let right = maybe_parse_shift_expression(None, context, @@ -948,7 +948,7 @@ fn maybe_parse_comparison_expression(preset_left: Option, let mut left = maybe_parse_shift_expression(preset_left, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_comparisons) { + if new_context.peek_kind(stream).is_some_and(understands_comparisons) { let operation = new_context.next_leaf(stream); let right = maybe_parse_comparison_expression(None, context, @@ -974,7 +974,7 @@ fn maybe_parse_equality_expression(preset_left: Option, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_equality) { + if new_context.peek_kind(stream).is_some_and(understands_equality) { let operation = new_context.next_leaf(stream); let right = maybe_parse_equality_expression(None, context, @@ -1002,7 +1002,7 @@ fn maybe_parse_binary_calc_expression(preset_left: Option, let mut left = maybe_parse_equality_expression(preset_left, &new_context, stream, file_info); - if new_context.peek_kind(stream).map_or(false, understands_binaries) { + if new_context.peek_kind(stream).is_some_and(understands_binaries) { let operation = new_context.next_leaf(stream); let right = maybe_parse_binary_calc_expression(None, context, @@ -1090,8 +1090,8 @@ pub fn maybe_parse_tertiary_expression(preset_left: Option, let mut left = maybe_parse_logic_or_expression(preset_left, &pre_quest_context, stream, file_info); - if pre_quest_context.peek_kind(stream).map_or( - false, |k|understands_tert_first_ops(k)) { + if pre_quest_context.peek_kind(stream).is_some_and( + |k|understands_tert_first_ops(k)) { let first_opr = pre_quest_context.next_leaf(stream); let opr_kind = match first_opr { LeafToken::Actual(token) => token.kind, diff --git a/src/analysis/parsing/misc.rs b/src/analysis/parsing/misc.rs index 481dc58..de974f1 100644 --- a/src/analysis/parsing/misc.rs +++ b/src/analysis/parsing/misc.rs @@ -429,8 +429,8 @@ impl CDeclList { -> CDeclList { let mut new_context = context.enter_context(doesnt_understand_tokens); let mut decls = vec![]; - let empty = !new_context.peek_kind(stream).map_or( - false, CDecl::first_token_matcher); + let empty = !new_context.peek_kind(stream).is_some_and( + CDecl::first_token_matcher); // Note that trailing commas in these lists are NOT allowed, // which is why we only check for entry into the loop if !empty { diff --git a/src/analysis/parsing/statement.rs b/src/analysis/parsing/statement.rs index 5d3da73..d34047c 100644 --- a/src/analysis/parsing/statement.rs +++ b/src/analysis/parsing/statement.rs @@ -177,7 +177,7 @@ impl Parse for CompoundContent { statements.push(Statement::parse(&statement_context, stream, file_info)); cont = statement_context.peek_kind(stream) - .map_or(false, dmlstatement_first_token_matcher); + .is_some_and(dmlstatement_first_token_matcher); } let rbrace = new_context.expect_next_kind(stream, TokenKind::RBrace); StatementContent::Compound(CompoundContent { @@ -666,6 +666,7 @@ impl TreeElement for ForPostElement { } } +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, PartialEq)] pub enum ForPre { Declaration(LeafToken, VarDecl, Option<(LeafToken, Initializer)>), @@ -966,11 +967,11 @@ fn parse_switchhashif(context: &ParseContext, stream: &mut FileParser<'_>, file_ let lbrace = outer_context.expect_next_kind(stream, TokenKind::LBrace); let mut rbrace_context = outer_context.enter_context(understands_rbrace); let mut truecases = vec![]; - while rbrace_context.peek_kind(stream).map_or( - false, |t|matches!(t, - TokenKind::HashIf | - TokenKind::Case | - TokenKind::Default) || + while rbrace_context.peek_kind(stream).is_some_and( + |t|matches!(t, + TokenKind::HashIf | + TokenKind::Case | + TokenKind::Default) || dmlstatement_first_token_matcher(t)) { truecases.push(parse_switchcase(&rbrace_context, stream, file_info)); } @@ -983,11 +984,11 @@ fn parse_switchhashif(context: &ParseContext, stream: &mut FileParser<'_>, file_ let mut falsecases = vec![]; let mut rbrace_context = outer_context.enter_context( understands_rbrace); - while rbrace_context.peek_kind(stream).map_or( - false, |t|matches!(t, - TokenKind::HashIf | - TokenKind::Case | - TokenKind::Default) || + while rbrace_context.peek_kind(stream).is_some_and( + |t|matches!(t, + TokenKind::HashIf | + TokenKind::Case | + TokenKind::Default) || dmlstatement_first_token_matcher(t)){ falsecases.push(parse_switchcase(&rbrace_context, stream, file_info)); } @@ -1147,11 +1148,11 @@ impl Parse for SwitchContent { let mut rbrace_context = outer_context.enter_context( understands_rbrace); let mut cases = vec![]; - while rbrace_context.peek_kind(stream).map_or( - false, |t|matches!(t, - TokenKind::HashIf | - TokenKind::Case | - TokenKind::Default) || + while rbrace_context.peek_kind(stream).is_some_and( + |t|matches!(t, + TokenKind::HashIf | + TokenKind::Case | + TokenKind::Default) || dmlstatement_first_token_matcher(t)) { cases.push(parse_switchcase(&rbrace_context, stream, file_info)); } diff --git a/src/analysis/parsing/structure.rs b/src/analysis/parsing/structure.rs index c0b9104..d94e0dd 100644 --- a/src/analysis/parsing/structure.rs +++ b/src/analysis/parsing/structure.rs @@ -760,7 +760,7 @@ fn check_dmlobject_kind(obj: &DMLObjectContent, _file: &TextFile) -> }, DMLObjectContent::Method(methodcontent) => { if methodcontent.modifier.as_ref().and_then(|m|m.get_token()) - .map_or(false, |s|s.kind == TokenKind::Shared) { + .is_some_and(|s|s.kind == TokenKind::Shared) { return vec![LocalDMLError { range: obj.range(), description: "Shared method \ @@ -813,8 +813,8 @@ impl Parse for ObjectStatements { let mut bracecontext = outer.enter_context( understands_rbrace); let mut statements = vec![]; - while bracecontext.peek_kind(stream).map_or( - false, |t|dmlobject_first_token_matcher(t)) { + while bracecontext.peek_kind(stream).is_some_and( + |t|dmlobject_first_token_matcher(t)) { statements.push( DMLObject::parse(&bracecontext, stream, file_info)); } diff --git a/src/analysis/parsing/types.rs b/src/analysis/parsing/types.rs index 7335632..0f65ea3 100644 --- a/src/analysis/parsing/types.rs +++ b/src/analysis/parsing/types.rs @@ -337,8 +337,7 @@ impl Parse for BitfieldsContent { TokenKind::IntConstant); let lbrace = new_context.expect_next_kind(stream, TokenKind::LBrace); let mut fields = vec![]; - while new_context.peek_kind(stream).map_or( - false, + while new_context.peek_kind(stream).is_some_and( CDecl::first_token_matcher) { fields.push(BitfieldsDeclContent::parse( &list_context, stream, file_info)); @@ -450,8 +449,7 @@ impl Parse for HookTypeContent { let hook = new_context.next_leaf(stream); let lparen = new_context.expect_next_kind(stream, TokenKind::LParen); let mut args = vec![]; - while new_context.peek_kind(stream).map_or( - false, + while new_context.peek_kind(stream).is_some_and( CDecl::first_token_matcher) { let arg = CDecl::parse(&new_context, stream, file_info); let next_kind = new_context.peek_kind(stream); @@ -459,8 +457,8 @@ impl Parse for HookTypeContent { // if we would loop again, we can catch the case // "hook(typ1 typ2)" and correctly expect a comma between the cdecls let comma = if next_kind == Some(TokenKind::Comma) - || new_context.peek_kind(stream).map_or( - false, CDecl::first_token_matcher) { + || new_context.peek_kind(stream).is_some_and( + CDecl::first_token_matcher) { Some(new_context.expect_next_kind(stream, TokenKind::Comma)) } else { None diff --git a/src/analysis/structure/objects.rs b/src/analysis/structure/objects.rs index 4d7d537..62ff1a0 100644 --- a/src/analysis/structure/objects.rs +++ b/src/analysis/structure/objects.rs @@ -1154,7 +1154,7 @@ impl ToStructure for Parameter { .map_or((false, None), |d| match d { structure::ParamDef::Set(assigntok, expr) => { (assigntok.get_token() - .map_or(false, |rt|rt.kind == TokenKind::Default), + .is_some_and(|rt|rt.kind == TokenKind::Default), ExpressionKind::to_expression(expr, report, file).map( |e|ParamValue::Set(e))) }, diff --git a/src/analysis/symbols.rs b/src/analysis/symbols.rs index 1819203..b201c60 100644 --- a/src/analysis/symbols.rs +++ b/src/analysis/symbols.rs @@ -109,6 +109,7 @@ impl SimpleSymbol { } } +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, Eq, PartialEq)] pub enum SymbolSource { DMLObject(DMLObject), diff --git a/src/analysis/templating/objects.rs b/src/analysis/templating/objects.rs index bdf764f..e90e1af 100644 --- a/src/analysis/templating/objects.rs +++ b/src/analysis/templating/objects.rs @@ -253,8 +253,7 @@ pub fn create_objectspec<'t>(loc: ZeroSpan, let inferior_ranks = in_each_struct.inferior.iter().filter( |(name, kind)|invalid_isimps.get(kind) - .map_or(true, - |container|!container.contains(name))).map( + .is_none_or(|container|!container.contains(name))).map( |(name, _)|templates.get(*name).unwrap_or_else(||panic!( "Internal Error: \ Unexpectedly missing def for template '{:?}'", name)) @@ -366,6 +365,7 @@ pub trait DMLHierarchyMember : DMLNamedMember { // underlying objects carry their own multiple definitions // This means we might miss some cases where we refer to a composite object // that does not actually exist +#[allow(clippy::large_enum_variant)] #[derive(Debug, Clone, PartialEq, Eq)] pub enum DMLObject { // This is a key to be used in the structure dictionary for @@ -1234,8 +1234,8 @@ fn resolve_parameter(obj_loc: &ZeroSpan, // find if we're an auto param for (def, _) in &sorted_definitions { - if def.obj.value.as_ref().map_or( - false, |v|matches!(v, ParamValue::Auto(_))) { + if def.obj.value.as_ref().is_some_and( + |v|matches!(v, ParamValue::Auto(_))) { if sorted_definitions.len() > 1 { report.push(DMLError { span: *def.obj.span(), diff --git a/src/analysis/templating/topology.rs b/src/analysis/templating/topology.rs index 7a1b0c7..5a0645b 100644 --- a/src/analysis/templating/topology.rs +++ b/src/analysis/templating/topology.rs @@ -713,8 +713,7 @@ pub fn rank_templates_aux<'t>(mut templates: HashMap<&'t str, for stmnt in spec.all_statements() { match stmnt { StatementSpecStatement::Import(imp) => { - if imp_map.get(&imp.obj).map_or( - false, + if imp_map.get(&imp.obj).is_some_and( |iname|iname == templ2.get_name()) { is_import_cycle = true; is_or_imp_sites.push(imp.span()); diff --git a/src/dfa/main.rs b/src/dfa/main.rs index 171f57f..c5e6032 100644 --- a/src/dfa/main.rs +++ b/src/dfa/main.rs @@ -8,15 +8,12 @@ use dls::config::Config; use std::path::PathBuf; -use std::convert::TryInto; use std::io::Write; -use subprocess::ExitStatus; use clap::{command, arg, Arg, ArgAction}; use dls::dfa::ClientInterface; - use log::debug; pub fn main() { diff --git a/src/lsp_data.rs b/src/lsp_data.rs index 2126843..eaa9290 100644 --- a/src/lsp_data.rs +++ b/src/lsp_data.rs @@ -47,7 +47,7 @@ where pub fn parse_file_path(uri: &Uri) -> Result { // NOTE: We do not need to mirror the windows->unix style file separators // here, as windows also accepts backslashes - if uri.scheme().map_or(false,|s|s.as_str() == "file") { + if uri.scheme().is_some_and(|s|s.as_str() == "file") { let decoded_path = urlencoding::decode(uri.path().as_str()) .map_err(|_|UriFileParseError::InvalidFilePath)?; Ok(Path::new( @@ -338,7 +338,7 @@ impl ClientCapabilities { impl ClientCapabilities { pub fn workspace_folder_support(&self) -> bool { self.capabilities.workspace.as_ref() - .map_or(false, |w|w.workspace_folders.unwrap_or(false)) + .is_some_and(|w|w.workspace_folders.unwrap_or(false)) } // (supported, dynamic registration supported) pub fn did_change_configuration_support(&self) -> (bool, bool) { @@ -351,7 +351,7 @@ impl ClientCapabilities { } pub fn configuration_support(&self) -> bool { self.capabilities.workspace.as_ref() - .map_or(false, |w|w.configuration.unwrap_or(false)) + .is_some_and(|w|w.configuration.unwrap_or(false)) } } diff --git a/src/main.rs b/src/main.rs index 924a63b..b32000d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ use log::debug; use std::path::PathBuf; use std::sync::Arc; -use clap::{Parser, command, arg}; +use clap::Parser; /// The main entry point to the DLS. // Parses CLI arguments and then runs the server. diff --git a/src/server/mod.rs b/src/server/mod.rs index 582a9ef..056e8dd 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -402,7 +402,7 @@ impl LsService { { if ctx.analysis.lock().unwrap() .get_isolated_analysis(&path) - .map_or(false, |a|a.is_device_file()) { + .is_ok_and(|a|a.is_device_file()) { // We cannot be sure that all the imported are // uncovered by contexts until we know // what all the imported files are, which @@ -746,7 +746,7 @@ mod test { .root_uri .as_ref() .map(|uri| { - assert!(uri.scheme().map_or(false,|s| s.as_str() == "file")); + assert!(uri.scheme().is_some_and(|s| s.as_str() == "file")); parse_file_path(uri).expect("Could not convert URI to path") }) .unwrap_or_else(|| { From 0dfeb5ec158eb27865e43afcc710036f8dc11c6b Mon Sep 17 00:00:00 2001 From: Jonatan Waern Date: Tue, 10 Mar 2026 15:21:36 +0100 Subject: [PATCH 3/3] Use rust 1.93 Signed-off-by: Jonatan Waern --- .github/workflows/binaries.yml | 2 +- .github/workflows/scans.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index a7ef6f4..98c2b13 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -28,7 +28,7 @@ on: type: string env: CARGO_TERM_COLOR: always - rust_version: 1.83.0 + rust_version: 1.93.0 jobs: build: runs-on: ${{ inputs.os }} diff --git a/.github/workflows/scans.yml b/.github/workflows/scans.yml index bad4fa6..af82e27 100644 --- a/.github/workflows/scans.yml +++ b/.github/workflows/scans.yml @@ -16,6 +16,7 @@ on: env: CARGO_TERM_COLOR: always + rust_version: 1.93.0 jobs: audit: runs-on: ${{ inputs.os }} @@ -23,6 +24,7 @@ jobs: - uses: actions/checkout@v4 - name: versions run: | + rustup default ${{ env.rust_version }} rustup --version cargo --version rustc --version