diff --git a/Cargo.toml b/Cargo.toml index d6d4d8e8..3501fb8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ members = [ [workspace.package] version = "1.11.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [profile.dev] opt-level = 1 @@ -24,3 +24,4 @@ opt-level = 1 [profile.release] lto = true codegen-units = 1 + diff --git a/crates/builtins-proc-macro/Cargo.toml b/crates/builtins-proc-macro/Cargo.toml index 4f9b7b8e..7c1e3d72 100644 --- a/crates/builtins-proc-macro/Cargo.toml +++ b/crates/builtins-proc-macro/Cargo.toml @@ -2,7 +2,7 @@ name = "builtins-proc-macro" version = "0.0.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [lib] proc-macro = true @@ -11,3 +11,4 @@ proc-macro = true syn = { version = "1.0", features = ["full"] } quote = "1.0" proc-macro2 = "1.0.89" + diff --git a/crates/dap-types/Cargo.toml b/crates/dap-types/Cargo.toml index 41ed3fa1..776b5083 100644 --- a/crates/dap-types/Cargo.toml +++ b/crates/dap-types/Cargo.toml @@ -2,10 +2,11 @@ name = "dap-types" version = "0.0.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [dependencies] serde = "1.0.213" serde_json = "1.0.132" serde_derive = "1.0.213" foldhash = "0.2.0" + diff --git a/crates/dm-langserver/Cargo.toml b/crates/dm-langserver/Cargo.toml index 22e8e07c..83d9fbce 100644 --- a/crates/dm-langserver/Cargo.toml +++ b/crates/dm-langserver/Cargo.toml @@ -29,3 +29,4 @@ ureq = "2.10.1" [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(auxtools_bundle)', 'cfg(extools_bundle)'] } + diff --git a/crates/dm-langserver/build.rs b/crates/dm-langserver/build.rs index bfdbc22d..3179b86e 100644 --- a/crates/dm-langserver/build.rs +++ b/crates/dm-langserver/build.rs @@ -87,11 +87,10 @@ fn download_dll(out_dir: &Path, fname: &str, tag: &str, url: &str, sha256: &str) ); println!("cargo:rustc-env=BUNDLE_VERSION_{fname}={tag}"); - if let Ok(digest) = sha256::try_digest(&full_path) { - if digest == sha256 { + if let Ok(digest) = sha256::try_digest(&full_path) + && digest == sha256 { return; } - } std::io::copy( &mut ureq::get(url) diff --git a/crates/dm-langserver/src/debugger/launched.rs b/crates/dm-langserver/src/debugger/launched.rs index 299aedfe..2036a7aa 100644 --- a/crates/dm-langserver/src/debugger/launched.rs +++ b/crates/dm-langserver/src/debugger/launched.rs @@ -213,7 +213,10 @@ mod raw { } pub unsafe fn kill(handle: Handle) -> bool { + #![allow(unsafe_code)] + unsafe{ libc::kill(handle, libc::SIGKILL) != -1 + } } } diff --git a/crates/dm-langserver/src/find_references.rs b/crates/dm-langserver/src/find_references.rs index 553b2b2b..a340634d 100644 --- a/crates/dm-langserver/src/find_references.rs +++ b/crates/dm-langserver/src/find_references.rs @@ -270,7 +270,7 @@ impl<'o> WalkProc<'o> { self.visit_expression(condition.location, &condition.elem, None); }, Statement::If { arms, else_arm } => { - for (condition, ref block) in arms.iter() { + for (condition, block) in arms.iter() { self.visit_expression(condition.location, &condition.elem, None); self.visit_block(block); } @@ -351,7 +351,7 @@ impl<'o> WalkProc<'o> { default, } => { self.visit_expression(location, input, None); - for (case, ref block) in cases.iter() { + for (case, block) in cases.iter() { for case_part in case.elem.iter() { match case_part { dm::ast::Case::Exact(expr) => { @@ -541,7 +541,7 @@ impl<'o> WalkProc<'o> { StaticType::None }, Term::InterpString(_, parts) => { - for (ref expr, _) in parts.iter() { + for (expr, _) in parts.iter() { if let Some(expr) = expr { self.visit_expression(location, expr, None); } @@ -603,7 +603,7 @@ impl<'o> WalkProc<'o> { Term::Locate { args, in_list } => { // TODO: use /proc/locate self.visit_arguments(location, args); - if let Some(ref expr) = in_list { + if let Some(expr) = in_list { self.visit_expression(location, expr, None); } StaticType::None @@ -615,7 +615,7 @@ impl<'o> WalkProc<'o> { } => { // TODO: use /proc/input self.visit_arguments(location, args); - if let Some(ref expr) = in_list { + if let Some(expr) = in_list { self.visit_expression(location, expr, None); } StaticType::None @@ -623,7 +623,7 @@ impl<'o> WalkProc<'o> { Term::Pick(args) => { // TODO: use /proc/pick for (weight, value) in args.iter() { - if let Some(ref weight) = weight { + if let Some(weight) = weight { self.visit_expression(location, weight, None); } self.visit_expression(location, value, None); diff --git a/crates/dm-langserver/src/main.rs b/crates/dm-langserver/src/main.rs index a0cb8772..11f7c23c 100644 --- a/crates/dm-langserver/src/main.rs +++ b/crates/dm-langserver/src/main.rs @@ -50,8 +50,10 @@ use std::sync::{Arc, Mutex}; use url::Url; fn main() { + #![allow(unsafe_code)] + unsafe{ std::env::set_var("RUST_BACKTRACE", "1"); - + } eprintln!( "dm-langserver {} Copyright (C) 2017-2025 Tad Hardesty", env!("CARGO_PKG_VERSION") @@ -838,7 +840,7 @@ impl Engine { { let mut found = None; let mut proc_name = None; - if_annotation! { Annotation::ProcBody(ref proc_path, ref idx) in iter; { + if_annotation! { Annotation::ProcBody(proc_path, idx) in iter; { // chop off proc name and 'proc/' or 'verb/' if it's there // TODO: factor this logic somewhere let mut proc_path = &proc_path[..]; @@ -2041,7 +2043,7 @@ impl Engine { let iter = annotations.get_location(location); let mut result = None; - if_annotation! { Annotation::ProcArguments(priors, proc_name, mut idx) in iter; { + if_annotation! { &Annotation::ProcArguments(ref priors, ref proc_name, mut idx) in iter; { // take the specific argument we're working on if_annotation! { Annotation::ProcArgument(i) in iter; { idx = *i; @@ -2153,7 +2155,7 @@ impl Engine { let range = span_to_range(start..end); let selection_range = location_to_range(start); match annotation { - Annotation::TreeBlock(ref path) => { + Annotation::TreeBlock(path) => { if path.is_empty() { continue; } @@ -2169,7 +2171,7 @@ impl Engine { children: Some(find_document_symbols(iter, end, path.len())), }); }, - Annotation::Variable(ref path) => { + Annotation::Variable(path) => { let (name, detail) = name_and_detail(path, skip_front); result.push(DocumentSymbol { name, @@ -2182,7 +2184,7 @@ impl Engine { children: None, }); }, - Annotation::ProcBody(ref path, _) => { + Annotation::ProcBody(path, _) => { if path.is_empty() { continue; } @@ -2205,7 +2207,7 @@ impl Engine { children: Some(find_document_symbols(iter, end, 0)), }); }, - Annotation::LocalVarScope(_, ref name) => { + Annotation::LocalVarScope(_, name) => { result.push(DocumentSymbol { name: name.to_string(), detail: None, @@ -2217,7 +2219,7 @@ impl Engine { children: None, }); }, - Annotation::MacroDefinition(ref name) => result.push(DocumentSymbol { + Annotation::MacroDefinition(name) => result.push(DocumentSymbol { name: name.to_string(), detail: None, kind: SymbolKind::CONSTANT, diff --git a/crates/dmdoc/Cargo.toml b/crates/dmdoc/Cargo.toml index 4bd8ec3a..5a506a79 100644 --- a/crates/dmdoc/Cargo.toml +++ b/crates/dmdoc/Cargo.toml @@ -19,3 +19,4 @@ walkdir = "2.5.0" [build-dependencies] chrono = "0.4.38" git2 = { version = "0.20.4", default-features = false } + diff --git a/crates/dmm-tools-cli/Cargo.toml b/crates/dmm-tools-cli/Cargo.toml index 482cb24c..d30d32fb 100644 --- a/crates/dmm-tools-cli/Cargo.toml +++ b/crates/dmm-tools-cli/Cargo.toml @@ -22,3 +22,4 @@ foldhash = "0.2.0" [build-dependencies] chrono = "0.4.38" git2 = { version = "0.20.4", default-features = false } + diff --git a/crates/dmm-tools/Cargo.toml b/crates/dmm-tools/Cargo.toml index c61bab25..c91dadb4 100644 --- a/crates/dmm-tools/Cargo.toml +++ b/crates/dmm-tools/Cargo.toml @@ -2,7 +2,7 @@ name = "dmm-tools" version = "0.1.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [dependencies] inflate = "0.4.5" @@ -36,3 +36,4 @@ optional = true [dev-dependencies] walkdir = "2.5.0" + diff --git a/crates/dreamchecker/Cargo.toml b/crates/dreamchecker/Cargo.toml index a5842880..8c524f58 100644 --- a/crates/dreamchecker/Cargo.toml +++ b/crates/dreamchecker/Cargo.toml @@ -12,3 +12,4 @@ foldhash = "0.2.0" [build-dependencies] chrono = "0.4.38" git2 = { version = "0.20.4", default-features = false } + diff --git a/crates/dreamchecker/src/lib.rs b/crates/dreamchecker/src/lib.rs index 681d071d..0888a8f5 100644 --- a/crates/dreamchecker/src/lib.rs +++ b/crates/dreamchecker/src/lib.rs @@ -1633,7 +1633,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { Statement::If { arms, else_arm } => { let mut allterm = ControlFlow::alltrue(); let mut alwaystrue = false; - for (condition, ref block) in arms.iter() { + for (condition, block) in arms.iter() { let mut scoped_locals = local_vars.clone(); self.visit_control_condition(condition.location, &condition.elem); if alwaystrue { @@ -1850,7 +1850,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { let mut allterm = ControlFlow::alltrue(); self.visit_control_condition(location, input); self.visit_expression(location, input, None, local_vars); - for (case, ref block) in cases.iter() { + for (case, block) in cases.iter() { let mut scoped_locals = local_vars.clone(); if let [dm::ast::Case::Exact(Expression::BinaryOp { op: BinaryOp::Or, .. @@ -2342,7 +2342,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { } }, Term::InterpString(_, parts) => { - for (ref expr, _) in parts.iter() { + for (expr, _) in parts.iter() { if let Some(expr) = expr { self.visit_expression(location, expr, None, local_vars); } @@ -2463,7 +2463,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { } // TODO: deal with in_list self.visit_arguments(location, args, local_vars); - if let Some(ref expr) = in_list { + if let Some(expr) = in_list { self.visit_expression(location, expr, None, local_vars); } @@ -2500,7 +2500,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { }, Term::Locate { args, in_list } => { self.visit_arguments(location, args, local_vars); - if let Some(ref expr) = in_list { + if let Some(expr) = in_list { self.visit_expression(location, expr, None, local_vars); } @@ -2513,7 +2513,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> { }, Term::Pick(choices) => { for (weight, choice) in choices.iter() { - if let Some(ref weight) = weight { + if let Some(weight) = weight { self.visit_expression(location, weight, None, local_vars); } self.visit_expression(location, choice, None, local_vars); diff --git a/crates/dreamchecker/src/switch_rand_range.rs b/crates/dreamchecker/src/switch_rand_range.rs index 6627e1db..868b9be9 100644 --- a/crates/dreamchecker/src/switch_rand_range.rs +++ b/crates/dreamchecker/src/switch_rand_range.rs @@ -69,7 +69,7 @@ pub fn check_switch_rand_range( fn get_case_range(case: &Case, location: Location) -> Option<(f32, f32)> { match case { - Case::Exact(ref value) => { + Case::Exact(value) => { let value = value .to_owned() .simple_evaluate(location) @@ -77,7 +77,7 @@ fn get_case_range(case: &Case, location: Location) -> Option<(f32, f32)> { .to_float()?; Some((value, value)) }, - Case::Range(ref min, ref max) => { + Case::Range(min, max) => { let min = min.to_owned().simple_evaluate(location).ok()?.to_float()?; let max = max.to_owned().simple_evaluate(location).ok()?.to_float()?; Some((min, max)) diff --git a/crates/dreammaker/Cargo.toml b/crates/dreammaker/Cargo.toml index 21ea687e..fa8308a0 100644 --- a/crates/dreammaker/Cargo.toml +++ b/crates/dreammaker/Cargo.toml @@ -2,7 +2,7 @@ name = "dreammaker" version = "0.1.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [dependencies] interval-tree = { path = "../interval-tree" } @@ -25,3 +25,4 @@ beef = "0.5.2" [dev-dependencies] walkdir = "2.5.0" + diff --git a/crates/dreammaker/src/constants.rs b/crates/dreammaker/src/constants.rs index a5edfdc5..887f043e 100644 --- a/crates/dreammaker/src/constants.rs +++ b/crates/dreammaker/src/constants.rs @@ -255,7 +255,7 @@ impl Constant { pub fn eq_resource(&self, resource: &str) -> bool { match self { - Constant::String(ref s) | Constant::Resource(ref s) => &**s == resource, + Constant::String(s) | Constant::Resource(s) => &**s == resource, _ => false, } } @@ -330,7 +330,7 @@ impl From for Constant { impl PartialEq for Constant { fn eq(&self, other: &str) -> bool { match self { - Constant::String(ref s) | Constant::Resource(ref s) => &**s == other, + Constant::String(s) | Constant::Resource(s) => &**s == other, _ => false, } } @@ -862,7 +862,7 @@ impl<'a> ConstantFolder<'a> { ))); } match args[0].as_term() { - Some(Term::Ident(ref ident)) => Constant::from(defines.contains_key(ident)), + Some(Term::Ident(ident)) => Constant::from(defines.contains_key(ident)), _ => { return Err(self .error("malformed defined() call, argument given isn't an Ident.")) diff --git a/crates/dreammaker/src/objtree.rs b/crates/dreammaker/src/objtree.rs index 31e80d44..cd5ad7a9 100644 --- a/crates/dreammaker/src/objtree.rs +++ b/crates/dreammaker/src/objtree.rs @@ -704,7 +704,7 @@ impl ObjectTree { // ------------------------------------------------------------------------ // Access - pub fn node_indices(&self) -> impl Iterator { + pub fn node_indices(&self) -> impl Iterator + use<> { (0..self.graph.len()).map(NodeIndex::new) } @@ -950,7 +950,7 @@ impl ObjectTreeBuilder { Ok(Constant::String(s)) => { parent_type = s; }, - Ok(Constant::Prefab(ref pop)) if pop.vars.is_empty() => { + Ok(Constant::Prefab(pop)) if pop.vars.is_empty() => { parent_type_buf = String::new(); for piece in pop.path.iter() { parent_type_buf.push('/'); diff --git a/crates/dreammaker/src/parser.rs b/crates/dreammaker/src/parser.rs index ae7e51fe..730916b5 100644 --- a/crates/dreammaker/src/parser.rs +++ b/crates/dreammaker/src/parser.rs @@ -1852,7 +1852,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { // check for a label `ident:` if let Statement::Expr(ref expr) = result { - if let Some(Term::Ident(ref name)) = expr.as_term() { + if let Some(Term::Ident(name)) = expr.as_term() { if let Some(()) = self.exact(Token::Punct(Punctuation::Colon))? { // it's a label! check for a block return spanned(Statement::Label { @@ -2361,7 +2361,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { self.expected("proc call"); let term = take_match!(self { // term :: 'new' (prefab | (ident field*))? arglist? - Token::Ident(ref i, _) if i == "new" => { + Token::Ident(i, _) if i == "new" => { // It's not entirely clear what is supposed to be valid here. // Some things definitely are: // * new() @@ -2423,24 +2423,24 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { // TODO: list arguments are actually subtly different, but // we're going to pretend they're not to make code simpler, and // anyone relying on the difference needs to fix their garbage - Token::Ident(ref i, _) if i == "list" => match self.arguments(&[], &ident!("list"))? { + Token::Ident(i, _) if i == "list" => match self.arguments(&[], &ident!("list"))? { Some(args) => Term::List(args), None => Term::Ident(i.to_owned()), }, - Token::Ident(ref i, _) if i == "alist" => match self.arguments(&[], &ident!("alist"))? { + Token::Ident(i, _) if i == "alist" => match self.arguments(&[], &ident!("alist"))? { Some(args) => Term::List(args), None => Term::Ident(i.to_owned()), }, // term :: 'call' arglist arglist - Token::Ident(ref i, _) if i == "call" => Term::DynamicCall( + Token::Ident(i, _) if i == "call" => Term::DynamicCall( require!(self.arguments(&[], &ident!("call"))), require!(self.arguments(&[], &ident!("call*"))), ), // term :: 'call_ext' ([library,] function) arglist - Token::Ident(ref i, _) if i == "call_ext" => { + Token::Ident(i, _) if i == "call_ext" => { require!(self.exact(Token::Punct(Punctuation::LParen))); let first = require!(self.expression()); let second = if self.exact(Token::Punct(Punctuation::Comma))?.is_some() { @@ -2468,7 +2468,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { }, // term :: 'input' arglist input_specifier - Token::Ident(ref i, _) if i == "input" => match self.arguments(&[], &ident!("input"))? { + Token::Ident(i, _) if i == "input" => match self.arguments(&[], &ident!("input"))? { Some(args) => { let (input_type, in_list) = require!(self.input_specifier()); Term::Input { @@ -2481,7 +2481,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { }, // term :: 'locate' arglist ('in' expression)? - Token::Ident(ref i, _) if i == "locate" => match self.arguments(&[], &ident!("locate"))? { + Token::Ident(i, _) if i == "locate" => match self.arguments(&[], &ident!("locate"))? { Some(args) => { // warn against this mistake if let Some(&Expression::BinaryOp { op: BinaryOp::In, .. } ) = args.first() { @@ -2507,34 +2507,34 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> { }, // term :: 'pick' pick_arglist - Token::Ident(ref i, _) if i == "pick" => match self.pick_arguments()? { + Token::Ident(i, _) if i == "pick" => match self.pick_arguments()? { Some(args) => Term::Pick(args), None => Term::Ident(i.to_owned()), }, - Token::Ident(ref i, _) if i == "null" => Term::Null, + Token::Ident(i, _) if i == "null" => Term::Null, // term :: 'as' '(' input_type ')' - Token::Ident(ref i, _) if i == "as" => { + Token::Ident(i, _) if i == "as" => { require!(self.exact(Token::Punct(Punctuation::LParen))); let input_type = self.input_type()?.unwrap_or_else(InputType::empty); require!(self.exact(Token::Punct(Punctuation::RParen))); Term::As(input_type) }, // term :: __PROC__ - Token::Ident(ref i, _) if i == "__PROC__" => { + Token::Ident(i, _) if i == "__PROC__" => { // We cannot replace with the proc path yet, you don't need one it's fine Term::__PROC__ }, // term :: __TYPE__ - Token::Ident(ref i, _) if i == "__TYPE__" => { + Token::Ident(i, _) if i == "__TYPE__" => { // We cannot replace with the typepath yet, so we'll hand back a term we can parse later Term::__TYPE__ }, // term :: __IMPLIED_TYPE__ - Token::Ident(ref i, _) if i == "__IMPLIED_TYPE__" => { + Token::Ident(i, _) if i == "__IMPLIED_TYPE__" => { // We cannot replace with the typepath yet, so we'll hand back a term we can parse later Term::__IMPLIED_TYPE__ }, diff --git a/crates/dreammaker/src/preprocessor.rs b/crates/dreammaker/src/preprocessor.rs index f8794f16..af00cb0e 100644 --- a/crates/dreammaker/src/preprocessor.rs +++ b/crates/dreammaker/src/preprocessor.rs @@ -317,7 +317,7 @@ struct IncludeStack<'ctx> { impl<'ctx> IncludeStack<'ctx> { fn top_file_path(&self) -> &Path { for each in self.stack.iter().rev() { - if let Include::File { ref path, .. } = each { + if let Include::File { path, .. } = each { return path; } } diff --git a/crates/interval-tree/Cargo.toml b/crates/interval-tree/Cargo.toml index e0f7a601..d9494e83 100644 --- a/crates/interval-tree/Cargo.toml +++ b/crates/interval-tree/Cargo.toml @@ -6,7 +6,8 @@ description = "A simple Interval Tree implementation" repository = "https://github.com/SpaceManiac/SpacemanDMM/tree/master/crates/interval-tree" keywords = ["datastructure", "interval", "tree", "map"] license-file = "LICENSE" -edition = "2021" +edition = "2024" [dev-dependencies] rand = "0.10.1" + diff --git a/crates/interval-tree/src/iterators.rs b/crates/interval-tree/src/iterators.rs index f1c9682a..c3cc78d0 100644 --- a/crates/interval-tree/src/iterators.rs +++ b/crates/interval-tree/src/iterators.rs @@ -146,12 +146,11 @@ impl Iterator for IntoIter { fn next(&mut self) -> Option<(RangeInclusive, V)> { loop { - if let Some((key, mut iter)) = self.current.take() { - if let Some(value) = iter.next() { + if let Some((key, mut iter)) = self.current.take() + && let Some(value) = iter.next() { self.current = Some((key.clone(), iter)); return Some((key, value)); } - } if self.current.is_none() { let mut node = self.stack.pop()?; diff --git a/crates/interval-tree/src/node.rs b/crates/interval-tree/src/node.rs index 000ea447..38c61364 100644 --- a/crates/interval-tree/src/node.rs +++ b/crates/interval-tree/src/node.rs @@ -34,16 +34,14 @@ impl Node { fn update_height(&mut self) { self.height = cmp::max(height(&self.left), height(&self.right)) + 1; self.max.clone_from(&self.key.end); - if let Some(ref left) = self.left { - if left.max > self.max { + if let Some(ref left) = self.left + && left.max > self.max { self.max.clone_from(&left.max); } - } - if let Some(ref right) = self.right { - if right.max > self.max { + if let Some(ref right) = self.right + && right.max > self.max { self.max.clone_from(&right.max); } - } } ///returns the minimal key,value pair within this tree diff --git a/crates/spaceman-dmm/Cargo.toml b/crates/spaceman-dmm/Cargo.toml index ade18655..a56d694e 100644 --- a/crates/spaceman-dmm/Cargo.toml +++ b/crates/spaceman-dmm/Cargo.toml @@ -2,7 +2,7 @@ name = "spaceman-dmm" version = "0.1.0" authors = ["Tad Hardesty "] -edition = "2021" +edition = "2024" [[bin]] name = "editor" @@ -31,3 +31,4 @@ git2 = { version = "0.20.2", default-features = false } [target.wasm32-unknown-emscripten.dependencies] sdl3 = { version = "0.16.4", features = ["build-from-source"] } +