Dedupe machine results
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::{Machine, MachineConfig, QueryResult, QueryResolution, QueryResolutionLine, Atom};
|
use super::{Machine, MachineConfig, QueryResult, QueryResolution, QueryResolutionLine, Atom};
|
||||||
|
|
||||||
impl Machine {
|
impl Machine {
|
||||||
@@ -16,6 +18,14 @@ impl Machine {
|
|||||||
if output.starts_with("error(") {
|
if output.starts_with("error(") {
|
||||||
Err(output)
|
Err(output)
|
||||||
} else {
|
} else {
|
||||||
|
// Remove duplicate lines
|
||||||
|
let output = output
|
||||||
|
.lines()
|
||||||
|
.collect::<HashSet<&str>>()
|
||||||
|
.iter()
|
||||||
|
.cloned()
|
||||||
|
.collect::<Vec<&str>>()
|
||||||
|
.join("\n");
|
||||||
Ok(output
|
Ok(output
|
||||||
.split(";")
|
.split(";")
|
||||||
.map(|s| s.trim())
|
.map(|s| s.trim())
|
||||||
|
|||||||
Reference in New Issue
Block a user