Skip to content

Commit

Permalink
Some small linting fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SLiV9 committed Aug 20, 2021
1 parent 4c7336f commit 8a28e86
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main()
let variant_filename = format!("{}/epicinium/bin/variant", out_dir);
let mut file = std::fs::File::create(variant_filename)
.expect("failed to create variant");
write!(file, "{}\n", variant).expect("failed to write variant");
writeln!(file, "{}", variant).expect("failed to write variant");

let working_dir = format!("{}/epicinium", out_dir);
let working_path = std::path::Path::new(&working_dir);
Expand Down
14 changes: 6 additions & 8 deletions src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ use log::{debug, error, info, trace, warn};
use libc::c_char;
use std::ffi::{CStr, CString};

use serde_json;

/**
* Returned by `custom_challenge_id` and `challenge_pool_get`,
* passed to `automaton_set_challenge`
Expand Down Expand Up @@ -101,7 +99,7 @@ pub fn allocate_automaton(
let ptr = unsafe {
epicinium_automaton_allocate(playercount, ruleset_name.as_ptr())
};
if ptr == std::ptr::null_mut()
if ptr.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
Expand All @@ -113,7 +111,7 @@ pub fn allocate_automaton(
}
}
let buffer = unsafe { epicinium_buffer_allocate() };
if buffer == std::ptr::null_mut()
if buffer.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
Expand Down Expand Up @@ -465,12 +463,12 @@ pub fn allocate_ai(
character,
)
};
if ptr == std::ptr::null_mut()
if ptr.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
let buffer = unsafe { epicinium_buffer_allocate() };
if buffer == std::ptr::null_mut()
if buffer.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
Expand Down Expand Up @@ -594,7 +592,7 @@ pub fn challenge_display_name(id: ChallengeId)
-> Result<String, InterfaceError>
{
let buffer = unsafe { epicinium_buffer_allocate() };
if buffer == std::ptr::null_mut()
if buffer.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
Expand Down Expand Up @@ -637,7 +635,7 @@ pub fn challenge_mission_briefing(
) -> Result<serde_json::Value, InterfaceError>
{
let buffer = unsafe { epicinium_buffer_allocate() };
if buffer == std::ptr::null_mut()
if buffer.is_null()
{
return Err(InterfaceError::AllocationFailed);
}
Expand Down
2 changes: 0 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
* Sander in 't Veld (sander@abunchofhacks.coop)
*/

use serde_json;

#[derive(Debug)]
pub enum InterfaceError
{
Expand Down

0 comments on commit 8a28e86

Please sign in to comment.