Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sthiele committed Oct 4, 2023
1 parent 35a7627 commit 59f3ca5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use vec1::Vec1;
/// The string members of a location object are internalized and valid for the duration of the process.
#[derive(Debug, Copy, Clone)]
pub struct Location(pub(crate) clingo_location);
impl Location {
impl Default for Location {
/// Create a default location.
pub fn default() -> Location {
fn default() -> Self {
let file = CString::new("").unwrap();
Location(clingo_location {
begin_line: 0,
Expand All @@ -37,6 +37,8 @@ impl Location {
end_file: file.as_ptr(),
})
}
}
impl Location {
/// Create a new location.
///
/// # Arguments
Expand Down Expand Up @@ -2289,7 +2291,7 @@ pub fn theory_guard_definition<'a>(
clingo_ast_build(
clingo_ast_type_e_clingo_ast_type_theory_guard_definition as i32,
&mut ast,
c_operators.as_ptr() as *const *const c_char,
c_operators.as_ptr(),
c_operators.len(),
term,
)
Expand Down
2 changes: 1 addition & 1 deletion src/ast_internals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'a> Drop for AST<'a> {
impl<'a> AST<'a> {
pub(crate) fn body(&self) -> Body {
Body(ASTArray {
ast: &self,
ast: self,
index: 0,
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ unsafe fn try_symbol_callback(
let name = name.to_str()?;
let symbols = efh.on_external_function(location, name, arguments)?;
if let Some(symbol_callback) = symbol_callback {
let v: Vec<clingo_symbol_t> = symbols.iter().map(|symbol| (*symbol).0).collect();
let v: Vec<clingo_symbol_t> = symbols.iter().map(|symbol| symbol.0).collect();
Ok(symbol_callback(
v.as_slice().as_ptr(),
v.len(),
Expand Down Expand Up @@ -3595,7 +3595,7 @@ impl TheoryAtoms {
pub fn iter(&self) -> TheoryAtomsIterator {
TheoryAtomsIterator {
count: 0,
atoms: &self,
atoms: self,
}
}

Expand Down Expand Up @@ -6544,7 +6544,7 @@ impl FactBase {
}
pub fn print(&self) {
for fact in &self.facts {
print!("{}.", fact.to_string());
print!("{fact}.");
}
println!();
}
Expand Down

0 comments on commit 59f3ca5

Please sign in to comment.