Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ members = [
[workspace.package]
version = "1.11.0"
authors = ["Tad Hardesty <tad@platymuus.com>"]
edition = "2021"
edition = "2024"

[profile.dev]
opt-level = 1

[profile.release]
lto = true
codegen-units = 1

3 changes: 2 additions & 1 deletion crates/builtins-proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "builtins-proc-macro"
version = "0.0.0"
authors = ["Tad Hardesty <tad@platymuus.com>"]
edition = "2021"
edition = "2024"

[lib]
proc-macro = true
Expand All @@ -11,3 +11,4 @@ proc-macro = true
syn = { version = "1.0", features = ["full"] }
quote = "1.0"
proc-macro2 = "1.0.89"

3 changes: 2 additions & 1 deletion crates/dap-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
name = "dap-types"
version = "0.0.0"
authors = ["Tad Hardesty <tad@platymuus.com>"]
edition = "2021"
edition = "2024"

[dependencies]
serde = "1.0.213"
serde_json = "1.0.132"
serde_derive = "1.0.213"
foldhash = "0.2.0"

1 change: 1 addition & 0 deletions crates/dm-langserver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ ureq = "2.10.1"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(auxtools_bundle)', 'cfg(extools_bundle)'] }

5 changes: 2 additions & 3 deletions crates/dm-langserver/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions crates/dm-langserver/src/debugger/launched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ mod raw {
}

pub unsafe fn kill(handle: Handle) -> bool {
#![allow(unsafe_code)]
unsafe{
libc::kill(handle, libc::SIGKILL) != -1
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions crates/dm-langserver/src/find_references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand All @@ -615,15 +615,15 @@ 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
},
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);
Expand Down
18 changes: 10 additions & 8 deletions crates/dm-langserver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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[..];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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,
Expand All @@ -2182,7 +2184,7 @@ impl Engine {
children: None,
});
},
Annotation::ProcBody(ref path, _) => {
Annotation::ProcBody(path, _) => {
if path.is_empty() {
continue;
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/dmdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ walkdir = "2.5.0"
[build-dependencies]
chrono = "0.4.38"
git2 = { version = "0.20.4", default-features = false }

1 change: 1 addition & 0 deletions crates/dmm-tools-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ foldhash = "0.2.0"
[build-dependencies]
chrono = "0.4.38"
git2 = { version = "0.20.4", default-features = false }

3 changes: 2 additions & 1 deletion crates/dmm-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "dmm-tools"
version = "0.1.0"
authors = ["Tad Hardesty <tad@platymuus.com>"]
edition = "2021"
edition = "2024"

[dependencies]
inflate = "0.4.5"
Expand Down Expand Up @@ -36,3 +36,4 @@ optional = true

[dev-dependencies]
walkdir = "2.5.0"

1 change: 1 addition & 0 deletions crates/dreamchecker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ foldhash = "0.2.0"
[build-dependencies]
chrono = "0.4.38"
git2 = { version = "0.20.4", default-features = false }

12 changes: 6 additions & 6 deletions crates/dreamchecker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, ..
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions crates/dreamchecker/src/switch_rand_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ 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)
.ok()?
.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))
Expand Down
3 changes: 2 additions & 1 deletion crates/dreammaker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "dreammaker"
version = "0.1.0"
authors = ["Tad Hardesty <tad@platymuus.com>"]
edition = "2021"
edition = "2024"

[dependencies]
interval-tree = { path = "../interval-tree" }
Expand All @@ -25,3 +25,4 @@ beef = "0.5.2"

[dev-dependencies]
walkdir = "2.5.0"

6 changes: 3 additions & 3 deletions crates/dreammaker/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ impl From<bool> for Constant {
impl PartialEq<str> 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,
}
}
Expand Down Expand Up @@ -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."))
Expand Down
4 changes: 2 additions & 2 deletions crates/dreammaker/src/objtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ impl ObjectTree {
// ------------------------------------------------------------------------
// Access

pub fn node_indices(&self) -> impl Iterator<Item = NodeIndex> {
pub fn node_indices(&self) -> impl Iterator<Item = NodeIndex> + use<> {
(0..self.graph.len()).map(NodeIndex::new)
}

Expand Down Expand Up @@ -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('/');
Expand Down
Loading