clippy
This commit is contained in:
@@ -1727,7 +1727,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
self.print_stream(stream, max_depth);
|
self.print_stream(stream, max_depth);
|
||||||
}
|
}
|
||||||
(ArenaHeaderTag::TcpListener, listener) => {
|
(ArenaHeaderTag::TcpListener, listener) => {
|
||||||
self.print_tcp_listener(&*listener, max_depth);
|
self.print_tcp_listener(&listener, max_depth);
|
||||||
}
|
}
|
||||||
(ArenaHeaderTag::Dropped, _value) => {
|
(ArenaHeaderTag::Dropped, _value) => {
|
||||||
self.print_impromptu_atom(atom!("$dropped_value"));
|
self.print_impromptu_atom(atom!("$dropped_value"));
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ pub fn prolog_value_to_json_tring(value: Value) -> String {
|
|||||||
//escape double quotes
|
//escape double quotes
|
||||||
format!(
|
format!(
|
||||||
"\"{}\"",
|
"\"{}\"",
|
||||||
s.replace("\"", "\\\"")
|
s.replace('\"', "\\\"")
|
||||||
.replace("\n", "\\n")
|
.replace('\n', "\\n")
|
||||||
.replace("\t", "\\t")
|
.replace('\t', "\\t")
|
||||||
.replace("\r", "\\r")
|
.replace('\r', "\\r")
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
//return valid json string
|
//return valid json string
|
||||||
@@ -39,22 +39,22 @@ pub fn prolog_value_to_json_tring(value: Value) -> String {
|
|||||||
let mut string_result = "[".to_string();
|
let mut string_result = "[".to_string();
|
||||||
for (i, v) in l.iter().enumerate() {
|
for (i, v) in l.iter().enumerate() {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
string_result.push_str(",");
|
string_result.push(',');
|
||||||
}
|
}
|
||||||
string_result.push_str(&prolog_value_to_json_tring(v.clone()));
|
string_result.push_str(&prolog_value_to_json_tring(v.clone()));
|
||||||
}
|
}
|
||||||
string_result.push_str("]");
|
string_result.push(']');
|
||||||
string_result
|
string_result
|
||||||
}
|
}
|
||||||
Value::Structure(s, l) => {
|
Value::Structure(s, l) => {
|
||||||
let mut string_result = format!("\"{}\":[", s.as_str());
|
let mut string_result = format!("\"{}\":[", s.as_str());
|
||||||
for (i, v) in l.iter().enumerate() {
|
for (i, v) in l.iter().enumerate() {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
string_result.push_str(",");
|
string_result.push(',');
|
||||||
}
|
}
|
||||||
string_result.push_str(&prolog_value_to_json_tring(v.clone()));
|
string_result.push_str(&prolog_value_to_json_tring(v.clone()));
|
||||||
}
|
}
|
||||||
string_result.push_str("]");
|
string_result.push(']');
|
||||||
string_result
|
string_result
|
||||||
}
|
}
|
||||||
_ => "null".to_string(),
|
_ => "null".to_string(),
|
||||||
@@ -65,7 +65,7 @@ fn prolog_match_to_json_string(query_match: &QueryMatch) -> String {
|
|||||||
let mut string_result = "{".to_string();
|
let mut string_result = "{".to_string();
|
||||||
for (i, (k, v)) in query_match.bindings.iter().enumerate() {
|
for (i, (k, v)) in query_match.bindings.iter().enumerate() {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
string_result.push_str(",");
|
string_result.push(',');
|
||||||
}
|
}
|
||||||
string_result.push_str(&format!(
|
string_result.push_str(&format!(
|
||||||
"\"{}\":{}",
|
"\"{}\":{}",
|
||||||
@@ -73,7 +73,7 @@ fn prolog_match_to_json_string(query_match: &QueryMatch) -> String {
|
|||||||
prolog_value_to_json_tring(v.clone())
|
prolog_value_to_json_tring(v.clone())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
string_result.push_str("}");
|
string_result.push('}');
|
||||||
string_result
|
string_result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ impl ToString for QueryResolution {
|
|||||||
QueryResolution::Matches(matches) => {
|
QueryResolution::Matches(matches) => {
|
||||||
let matches_json: Vec<String> = matches
|
let matches_json: Vec<String> = matches
|
||||||
.iter()
|
.iter()
|
||||||
.map(|m| prolog_match_to_json_string(m))
|
.map(prolog_match_to_json_string)
|
||||||
.collect();
|
.collect();
|
||||||
format!("[{}]", matches_json.join(","))
|
format!("[{}]", matches_json.join(","))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1875,7 +1875,7 @@ impl MachineState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if path.extension().is_none() {
|
if path.extension().is_none() {
|
||||||
if let Some(metadata) = file.metadata().ok() {
|
if let Ok(metadata) = file.metadata() {
|
||||||
if metadata.is_dir() {
|
if metadata.is_dir() {
|
||||||
path.set_extension("pl");
|
path.set_extension("pl");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -5629,7 +5629,7 @@ impl Machine {
|
|||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn inference_count(&mut self, count_var: HeapCellValue, count: Integer) {
|
pub(crate) fn inference_count(&mut self, count_var: HeapCellValue, count: Integer) {
|
||||||
if let Some(value) = <&Integer as TryInto<i64>>::try_into(&count).ok() {
|
if let Ok(value) = <&Integer as TryInto<i64>>::try_into(&count) {
|
||||||
self.machine_st
|
self.machine_st
|
||||||
.unify_fixnum(Fixnum::build_with(value), count_var);
|
.unify_fixnum(Fixnum::build_with(value), count_var);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user