remove warnings about user settings deeper in the stack

This commit is contained in:
Graham Christensen 2020-03-30 16:31:00 -04:00
parent 13ea5fded4
commit a2bbc8d258
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F
2 changed files with 8 additions and 7 deletions

View file

@ -349,9 +349,17 @@ fn lines_from_file(file: fs::File) -> Vec<String> {
.lines() .lines()
.filter(|line| line.is_ok()) .filter(|line| line.is_ok())
.map(|line| line.unwrap()) .map(|line| line.unwrap())
.filter(|msg| !is_user_setting_warning(msg))
.collect() .collect()
} }
fn is_user_setting_warning(line: &str) -> bool {
let line = line.trim();
line.starts_with("warning: ignoring the user-specified setting '")
&& line.ends_with("because it is a restricted setting and you are not a trusted user")
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
fn nix() -> Nix { fn nix() -> Nix {

View file

@ -43,7 +43,6 @@ impl HydraNixEnv {
.collect::<Result<Vec<String>, _>>()? .collect::<Result<Vec<String>, _>>()?
.into_iter() .into_iter()
.filter(|msg| msg.trim().len() > 0) .filter(|msg| msg.trim().len() > 0)
.filter(|msg| !is_user_setting_warning(msg))
.collect::<Vec<String>>(); .collect::<Vec<String>>();
if evaluation_errors.len() > 0 { if evaluation_errors.len() > 0 {
@ -173,9 +172,3 @@ impl Error {
} }
} }
} }
fn is_user_setting_warning(line: &str) -> bool {
let line = line.trim();
line.starts_with("warning: ignoring the user-specified setting '")
&& line.ends_with("because it is a restricted setting and you are not a trusted user")
}