Skip to content

Commit d54269c

Browse files
committed
Make Dylint happy
1 parent ea637d3 commit d54269c

8 files changed

Lines changed: 19 additions & 23 deletions

File tree

test-fuzz/tests/integration/ci.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn markdown_link_check() {
9999
.logged_assert()
100100
.success();
101101

102-
let readme_md = Path::new(env!("CARGO_MANIFEST_DIR")).join("../README.md");
102+
let readme_md = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../README.md"));
103103

104104
Command::new("npx")
105105
.args(["markdown-link-check", readme_md.to_str().unwrap()])
@@ -282,12 +282,15 @@ fn supply_chain() {
282282
remove_avatars(&mut value);
283283
let stdout_normalized = serde_json::to_string_pretty(&value).unwrap();
284284

285-
let path_buf = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/supply_chain.json");
285+
let path = Path::new(concat!(
286+
env!("CARGO_MANIFEST_DIR"),
287+
"/tests/supply_chain.json"
288+
));
286289

287290
if enabled("BLESS") {
288-
write(path_buf, stdout_normalized).unwrap();
291+
write(path, stdout_normalized).unwrap();
289292
} else {
290-
let stdout_expected = read_to_string(&path_buf).unwrap();
293+
let stdout_expected = read_to_string(path).unwrap();
291294

292295
assert!(
293296
stdout_expected == stdout_normalized,

test-fuzz/tests/integration/conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn test() -> Command {
2121
command.args([
2222
"test",
2323
"--manifest-path",
24-
&MANIFEST_PATH,
24+
MANIFEST_PATH,
2525
"--no-run",
2626
"--features",
2727
&("test-fuzz/".to_owned() + test_fuzz::serde_format::as_feature()),

test-fuzz/tests/integration/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn link() {
1111
.args([
1212
"build",
1313
"--manifest-path",
14-
&MANIFEST_PATH,
14+
MANIFEST_PATH,
1515
"--features",
1616
&("test-fuzz/".to_owned() + test_fuzz::serde_format::as_feature()),
1717
])

test-fuzz/tests/integration/rename.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn test() -> Command {
2222
command.args([
2323
"test",
2424
"--manifest-path",
25-
&MANIFEST_PATH,
25+
MANIFEST_PATH,
2626
"--no-run",
2727
"--features",
2828
&("test-fuzz/".to_owned() + test_fuzz::serde_format::as_feature()),

test-fuzz/tests/integration/self_ty_in_mod_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn test() -> Command {
2727
command.args([
2828
"test",
2929
"--manifest-path",
30-
&MANIFEST_PATH,
30+
MANIFEST_PATH,
3131
"--no-run",
3232
"--features",
3333
&("test-fuzz/".to_owned() + test_fuzz::serde_format::as_feature()),

test-fuzz/tests/integration/test_fuzz_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn test_fuzz_log() {
1010
.args([
1111
"test",
1212
"--manifest-path",
13-
&MANIFEST_PATH,
13+
MANIFEST_PATH,
1414
"--no-run",
1515
"--features",
1616
&("test-fuzz/".to_owned() + test_fuzz::serde_format::as_feature()),

testing/src/fuzzable.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@ use anyhow::{Context, Result, bail, ensure};
22
use cargo_metadata::{Artifact, ArtifactProfile, Message};
33
use internal::serde_format;
44
use log::debug;
5-
use std::{path::Path, process::Command, sync::LazyLock};
5+
use std::process::Command;
66
use subprocess::{Exec, Redirection};
77

8-
pub static MANIFEST_PATH: LazyLock<String> = LazyLock::new(|| {
9-
#[cfg_attr(dylint_lib = "general", allow(abs_home_path))]
10-
Path::new(env!("CARGO_MANIFEST_DIR"))
11-
.join("../fuzzable/Cargo.toml")
12-
.to_string_lossy()
13-
.to_string()
14-
});
8+
#[cfg_attr(dylint_lib = "general", allow(abs_home_path))]
9+
pub const MANIFEST_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../fuzzable/Cargo.toml");
1510

1611
// smoelius: We want to reuse the existing features. So we can't do anything that would cause the
1712
// fuzzable examples to be rebuilt.
@@ -24,7 +19,7 @@ pub fn test(krate: &str, test: &str) -> Result<Command> {
2419
let mut args = vec![
2520
"test",
2621
"--manifest-path",
27-
&*MANIFEST_PATH,
22+
MANIFEST_PATH,
2823
"--test",
2924
krate,
3025
"--features",
@@ -95,7 +90,7 @@ pub fn test_fuzz_all() -> Result<Command> {
9590
"--",
9691
"test-fuzz",
9792
"--manifest-path",
98-
&*MANIFEST_PATH,
93+
MANIFEST_PATH,
9994
"--features",
10095
&serde_format_feature,
10196
];

third-party/tests/third_party.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ struct Test {
3838

3939
static TESTS: LazyLock<Vec<Test>> = LazyLock::new(|| {
4040
#[cfg_attr(dylint_lib = "general", allow(abs_home_path))]
41-
let content =
42-
read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join("third_party.json")).unwrap();
41+
let content = read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/third_party.json")).unwrap();
4342
serde_json::from_str(&content).unwrap()
4443
});
4544

@@ -87,8 +86,7 @@ fn run_test(test: &Test, no_run: bool) {
8786
.success();
8887

8988
#[cfg_attr(dylint_lib = "general", allow(abs_home_path))]
90-
let patch = Path::new(env!("CARGO_MANIFEST_DIR"))
91-
.join("patches")
89+
let patch = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/patches"))
9290
.join(&test.patch)
9391
.canonicalize()
9492
.unwrap();

0 commit comments

Comments
 (0)