Skip to content

Commit

Permalink
update deps, update to rust 1.74
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Nov 20, 2023
1 parent 6a185cb commit 6576dda
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 149 deletions.
164 changes: 75 additions & 89 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@ resolver = "2"
[workspace.dependencies]
ariadne = "0.3.0"
byteorder = "1.5.0"
clap = "4.4.7"
clap = "4.4.8"
git2 = "0.18.1"
lsp-types = "0.94.1"
peekmore = "1.3.0"
pest = "2.7.5"
pest_derive = "2.7.5"
serde = { version = "1.0.190", features = ["derive"] }
serde = { version = "1.0.192", features = ["derive"] }
serde_json = "1.0.108"
sha-1 = "0.10.1"
toml = "0.8.6"
toml = "0.8.8"
tracing = { version = "0.1.40", features = ["attributes"] }
vfs = "0.10.0"
walkdir = "2.4.0"
zip = "0.6.6"

[workspace.lints.clippy]
all = "deny"
nursery = "deny"
pedantic = "warn"

[profile.bench]
lto = true
7 changes: 5 additions & 2 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ edition = "2021"
license = "GPL-2.0"
authors = ["Brett Mayson <[email protected]>"]

[lints]
workspace = true

[lib]
bench = false

Expand Down Expand Up @@ -39,15 +42,15 @@ serde_json = { workspace = true }
steamlocate = "2.0.0-alpha.0"
time = { version = "0.3.30", features = ["formatting"] }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.17", features = ["json"] }
tracing-subscriber = { version = "0.3.18", features = ["json"] }
vfs = { workspace = true }
walkdir = { workspace = true }
whoami = "1.4.1"
zip = { workspace = true }

[target.'cfg(windows)'.dependencies]
enable-ansi-support = "0.2.1"
winreg = "0.51.0"
winreg = "0.52.0"

[dev-dependencies]
paste = "1.0.14"
2 changes: 1 addition & 1 deletion bin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pub fn main() {
if cfg!(debug_assertions) {
base.push_str("-debug");
}
println!("cargo:rustc-env=HEMTT_VERSION={}", base);
println!("cargo:rustc-env=HEMTT_VERSION={base}");
}
6 changes: 6 additions & 0 deletions bin/src/commands/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub fn cli() -> Command {
///
/// # Errors
/// [`Error`] depending on the modules
///
/// # Panics
/// Will panic if the regex can not be compiled, which should never be the case in a released version
pub fn execute(matches: &ArgMatches) -> Result<(), Error> {
let config = ProjectConfig::from_file(&Path::new(".hemtt").join("project.toml"))?;
let Some(mainprefix) = config.mainprefix() else {
Expand Down Expand Up @@ -210,6 +213,9 @@ pub fn execute(matches: &ArgMatches) -> Result<(), Error> {
}

/// Read a preset file and return the mods and DLCs
///
/// # Panics
/// Will panic if the regex can not be compiled, which should never be the case in a released version
pub fn read_preset(name: &str, html: &str) -> (Vec<String>, Vec<DLC>) {
let mut workshop = Vec::new();
let mut dlc = Vec::new();
Expand Down
3 changes: 0 additions & 3 deletions bin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![deny(clippy::all, clippy::nursery)]
#![warn(clippy::pedantic)]

use clap::{ArgAction, ArgMatches, Command};
use context::Context;
pub use error::Error;
Expand Down
7 changes: 2 additions & 5 deletions bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#![deny(clippy::all, clippy::nursery)]
#![warn(clippy::pedantic)]

use tracing::{error, warn};
use tracing::error;

fn main() {
std::panic::set_hook(Box::new(|panic| {
Expand All @@ -26,7 +23,7 @@ It is always best to the include the log and a link to your project when reporti

#[cfg(windows)]
if enable_ansi_support::enable_ansi_support().is_err() {
warn!("Failed to enable ANSI support, colored output will not work");
tracing::warn!("Failed to enable ANSI support, colored output will not work");
}

if let Err(e) = hemtt::execute(&hemtt::cli().get_matches()) {
Expand Down
2 changes: 2 additions & 0 deletions bin/tests/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use hemtt::cli;

#[test]
/// # Panics
/// Will panic if there is an issue with the test
pub fn build() {
std::env::set_current_dir("tests/alpha").unwrap();
hemtt::execute(&cli().get_matches_from(vec!["hemtt", "dev", "--in-test"])).unwrap();
Expand Down
4 changes: 1 addition & 3 deletions bin/tests/preset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ fn preset(name: &str, mods: usize, dlc: &[DLC]) {
let html = PathBuf::from("tests/presets")
.join(name)
.with_extension("html");
if !html.exists() {
panic!("Preset not found: {}", name);
}
assert!(html.exists(), "Preset not found: {name}");
let html = std::fs::read_to_string(html).unwrap();
let (preset_mods, preset_dlc) = read_preset(name, &html);
assert_eq!(preset_mods.len(), mods);
Expand Down
3 changes: 3 additions & 0 deletions libs/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "A library for common Hemtt functionality"
license = "GPL-2.0"

[lints]
workspace = true

[dependencies]
git2 = { workspace = true }
serde = { workspace = true }
Expand Down
3 changes: 0 additions & 3 deletions libs/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![deny(clippy::all, clippy::nursery, missing_docs)]
#![warn(clippy::pedantic)]

//! HEMTT - Common Library
pub mod arma;
Expand Down
31 changes: 14 additions & 17 deletions libs/common/src/version.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#![deny(clippy::all, clippy::nursery, missing_docs)]
#![warn(clippy::pedantic)]

//! Versioning for Arma mods
use std::fmt::{Display, Formatter};
Expand Down Expand Up @@ -308,12 +305,12 @@ mod tests {

#[test]
fn test_script_version() {
let content = r#"
let content = r"
#define MAJOR 1
#define MINOR 2
#define PATCH 3
#define BUILD 4
"#;
";
let version = Version::try_from_script_version(content).unwrap();
assert_eq!(version.major, 1);
assert_eq!(version.minor, 2);
Expand All @@ -325,12 +322,12 @@ mod tests {

#[test]
fn test_script_version_comment() {
let content = r#"
let content = r"
#define MAJOR 1
#define MINOR 2
#define PATCHLVL 3 // some comment
#define BUILD 4
"#;
";
let version = Version::try_from_script_version(content).unwrap();
assert_eq!(version.major, 1);
assert_eq!(version.minor, 2);
Expand All @@ -341,11 +338,11 @@ mod tests {

#[test]
fn test_script_version_no_build() {
let content = r#"
let content = r"
#define MAJOR 1
#define MINOR 2
#define PATCH 3
"#;
";
let version = Version::try_from_script_version(content).unwrap();
assert_eq!(version.major, 1);
assert_eq!(version.minor, 2);
Expand All @@ -356,11 +353,11 @@ mod tests {

#[test]
fn test_script_version_invalid_component() {
let content = r#"
let content = r"
#define MAJOR 1
#define MINOR 2
#define PATCHLVL a
"#;
";
let version = Version::try_from_script_version(content);
assert!(version.is_err());
assert_eq!(
Expand All @@ -371,31 +368,31 @@ mod tests {

#[test]
fn test_script_version_missing_minor() {
let content = r#"
let content = r"
#define MAJOR 1
"#;
";
let version = Version::try_from_script_version(content);
assert!(version.is_err());
assert_eq!(version.unwrap_err(), Error::ExpectedMinor);
}

#[test]
fn test_script_version_missing_patch() {
let content = r#"
let content = r"
#define MAJOR 1
#define MINOR 2
"#;
";
let version = Version::try_from_script_version(content);
assert!(version.is_err());
assert_eq!(version.unwrap_err(), Error::ExpectedPatch);
}

#[test]
fn test_script_version_missing_major() {
let content = r#"
let content = r"
#define MINOR 2
#define PATCH 3
"#;
";
let version = Version::try_from_script_version(content);
assert!(version.is_err());
assert_eq!(version.unwrap_err(), Error::ExpectedMajor);
Expand Down
3 changes: 3 additions & 0 deletions libs/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "A config parser library for hemtt"
license = "GPL-2.0"

[lints]
workspace = true

[lib]
bench = false

Expand Down
2 changes: 0 additions & 2 deletions libs/config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![deny(clippy::all, clippy::nursery, missing_docs)]
#![warn(clippy::pedantic)]
#![allow(clippy::cast_possible_truncation)]

//! HEMTT - Arma 3 Config Parser
Expand Down
4 changes: 2 additions & 2 deletions libs/config/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ mod tests {

#[test]
fn empty() {
assert_eq!(config().parse(r#""#,), Ok(Config(vec![]),));
assert_eq!(config().parse(r#" "#,), Ok(Config(vec![]),));
assert_eq!(config().parse(r"",), Ok(Config(vec![]),));
assert_eq!(config().parse(r" ",), Ok(Config(vec![]),));
}

#[test]
Expand Down
3 changes: 3 additions & 0 deletions libs/pbo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "An PBO library for hemtt"
license = "GPL-2.0"

[lints]
workspace = true

[lib]
bench = false

Expand Down
2 changes: 0 additions & 2 deletions libs/pbo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![deny(clippy::all, clippy::nursery, missing_docs)]
#![warn(clippy::pedantic)]
#![allow(clippy::cast_possible_truncation, clippy::cast_lossless)]

//! HEMTT - Arma 3 PBO Writer/Reader
Expand Down
12 changes: 6 additions & 6 deletions libs/pbo/tests/ace_weather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn ace_weather_cba6f72c() {
header(
pbo.files().first().unwrap(),
"$PBOPREFIX$.backup",
Mime::Blank,
&Mime::Blank,
20,
0,
1_543_422_611,
Expand All @@ -28,7 +28,7 @@ fn ace_weather_cba6f72c() {
header(
pbo.header("$PBOPREFIX$.backup").unwrap(),
"$PBOPREFIX$.backup",
Mime::Blank,
&Mime::Blank,
20,
0,
1_543_422_611,
Expand All @@ -37,7 +37,7 @@ fn ace_weather_cba6f72c() {
file(
&mut pbo,
"XEH_preStart.sqf",
"#include \"script_component.hpp\"\r\n\r\n#include \"XEH_PREP.hpp\"\r\n".to_string(),
"#include \"script_component.hpp\"\r\n\r\n#include \"XEH_PREP.hpp\"\r\n",
);
let mut new_pbo = WritablePbo::new();
let mut new_files = std::collections::HashMap::new();
Expand Down Expand Up @@ -85,7 +85,7 @@ fn ace_weather_8bd4922f() {
header(
pbo.files().first().unwrap(),
"$PBOPREFIX$.backup",
Mime::Blank,
&Mime::Blank,
20,
0,
1_615_389_445,
Expand All @@ -94,7 +94,7 @@ fn ace_weather_8bd4922f() {
header(
pbo.header("$PBOPREFIX$.backup").unwrap(),
"$PBOPREFIX$.backup",
Mime::Blank,
&Mime::Blank,
20,
0,
1_615_389_445,
Expand All @@ -103,6 +103,6 @@ fn ace_weather_8bd4922f() {
file(
&mut pbo,
"XEH_preStart.sqf",
"#include \"script_component.hpp\"\r\n\r\n#include \"XEH_PREP.hpp\"\r\n".to_string(),
"#include \"script_component.hpp\"\r\n\r\n#include \"XEH_PREP.hpp\"\r\n",
);
}
13 changes: 10 additions & 3 deletions libs/pbo/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use std::{fs::File, io::Read};

use hemtt_pbo::{Checksum, Header, Mime, ReadablePbo};

#[must_use]
/// # Panics
/// Will panic if there is an issue with the test
pub fn pbo(
file: File,
file_count: usize,
Expand Down Expand Up @@ -37,24 +40,28 @@ pub fn pbo(
// assert_eq!(original.checksum(), writeable.checksum().unwrap());
// }

/// # Panics
/// Will panic if there is an issue with the test
pub fn header(
header: &Header,
filename: &str,
method: Mime,
method: &Mime,
original: u32,
reserved: u32,
timestamp: u32,
size: u32,
) {
assert_eq!(header.filename(), filename);
assert_eq!(header.mime(), &method);
assert_eq!(header.mime(), method);
assert_eq!(header.original(), original);
assert_eq!(header.reserved(), reserved);
assert_eq!(header.timestamp(), timestamp);
assert_eq!(header.size(), size);
}

pub fn file(pbo: &mut ReadablePbo<File>, file: &str, content: String) {
/// # Panics
/// Will panic if there is an issue with the test
pub fn file(pbo: &mut ReadablePbo<File>, file: &str, content: &str) {
let mut cursor = pbo.file(file).unwrap().unwrap();
let mut data = String::new();
cursor.read_to_string(&mut data).unwrap();
Expand Down
3 changes: 3 additions & 0 deletions libs/preprocessor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "A preprocessor library for hemtt"
license = "GPL-2.0"

[lints]
workspace = true

[lib]
bench = false

Expand Down
Loading

0 comments on commit 6576dda

Please sign in to comment.