Skip to content

Commit 877c0b1

Browse files
committed
fix(snap)!: Move path root macros to utils
1 parent ef2b41e commit 877c0b1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

crates/snapbox/src/data/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ macro_rules! file {
174174
$crate::Data::read_from(&path, Some($crate::data::DataFormat:: $type))
175175
}};
176176
[$path:literal] => {{
177-
let mut path = $crate::current_dir!();
177+
let mut path = $crate::utils::current_dir!();
178178
path.push($path);
179179
$crate::Data::read_from(&path, None)
180180
}};
181181
[$path:literal : $type:ident] => {{
182-
let mut path = $crate::current_dir!();
182+
let mut path = $crate::utils::current_dir!();
183183
path.push($path);
184184
$crate::Data::read_from(&path, Some($crate::data::DataFormat:: $type))
185185
}};
@@ -201,7 +201,7 @@ macro_rules! str {
201201
[$data:literal] => { $crate::str![[$data]] };
202202
[[$data:literal]] => {{
203203
let position = $crate::data::Position {
204-
file: $crate::path::current_rs!(),
204+
file: $crate::utils::current_rs!(),
205205
line: line!(),
206206
column: column!(),
207207
};

crates/snapbox/src/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ macro_rules! assert_data_eq {
5050
#[macro_export]
5151
macro_rules! current_dir {
5252
() => {{
53-
let root = $crate::path::cargo_rustc_current_dir!();
53+
let root = $crate::utils::cargo_rustc_current_dir!();
5454
let file = ::std::file!();
5555
let rel_path = ::std::path::Path::new(file).parent().unwrap();
5656
root.join(rel_path)
@@ -62,7 +62,7 @@ macro_rules! current_dir {
6262
#[macro_export]
6363
macro_rules! current_rs {
6464
() => {{
65-
let root = $crate::path::cargo_rustc_current_dir!();
65+
let root = $crate::utils::cargo_rustc_current_dir!();
6666
let file = ::std::file!();
6767
let rel_path = ::std::path::Path::new(file);
6868
root.join(rel_path)

crates/snapbox/src/path/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,3 @@ pub use ops::Walk;
2020
pub(crate) use ops::canonicalize;
2121
pub(crate) use ops::display_relpath;
2222
pub(crate) use ops::shallow_copy;
23-
24-
#[doc(inline)]
25-
pub use crate::cargo_rustc_current_dir;
26-
#[doc(inline)]
27-
pub use crate::current_dir;
28-
#[doc(inline)]
29-
pub use crate::current_rs;

crates/snapbox/src/utils/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
mod lines;
22

33
pub use lines::LinesWithTerminator;
4+
5+
#[doc(inline)]
6+
pub use crate::cargo_rustc_current_dir;
7+
#[doc(inline)]
8+
pub use crate::current_dir;
9+
#[doc(inline)]
10+
pub use crate::current_rs;

0 commit comments

Comments
 (0)