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