Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate current path through the rust code #130

Merged
merged 1 commit into from
May 30, 2024
Merged

Propagate current path through the rust code #130

merged 1 commit into from
May 30, 2024

Conversation

arduano
Copy link
Collaborator

@arduano arduano commented May 9, 2024

Propagate current path through the rust code

Propagating current path (workdir) through the rust code.

@@ -172,16 +171,11 @@ fn nix_value_from_module(
scope: &mut v8::ContextScope<v8::HandleScope>,
nix_value: v8::Local<v8::Function>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to your change, but I believe this variable has a misleading name. I think this should be nix_module_fn or something like that. If you agree, would you mind changing it while you're here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

src/tests/mod.rs Outdated
Ok(val) => val,
Err(err) => panic!(
"eval '{}' shouldn't fail.\nError message: {}",
"eval '{}' shouldn't fail.\nError message: {:?}",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total nitpick (feel free to ignore or do in a separate PR):

Suggested change
"eval '{}' shouldn't fail.\nError message: {:?}",
"eval '{nix_expr}' shouldn't fail.\nError message: {err:?}",

Then the line below can be removed.

src/tests/mod.rs Outdated
nix_expr, err
),
}
}

fn eval_err(nix_expr: &str) -> NixErrorKind {
evaluate(nix_expr)
let workdir = std::env::current_dir().unwrap();
evaluate(nix_expr, &workdir)
.expect_err(&format!("eval '{}' expected an error", nix_expr))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above (feel free to ignore etc.):

Suggested change
.expect_err(&format!("eval '{}' expected an error", nix_expr))
.expect_err(&format!("eval '{}' expected an error", nix_expr))
Suggested change
.expect_err(&format!("eval '{}' expected an error", nix_expr))
.expect_err(&format!("eval '{nix_expr}' expected an error"))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want these things to be picked up automatically, we can add clippy

urbas
urbas previously approved these changes May 27, 2024
Propagating current path (workdir) through the rust code.
@arduano arduano merged commit f0fd126 into master May 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants