Fixes for new Clippy (#755)
This commit is contained in:
parent
c4e0faabc2
commit
5823320206
@ -154,9 +154,9 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_atomic_file_write() {
|
fn test_atomic_file_write() {
|
||||||
let path = "test_atomic_file_write.tmp";
|
let path = "test_atomic_file_write.tmp";
|
||||||
write_file_atomic(&path, b"test").unwrap();
|
write_file_atomic(path, b"test").unwrap();
|
||||||
let content = fs::read_to_string(&path).unwrap();
|
let content = fs::read_to_string(path).unwrap();
|
||||||
fs::remove_file(&path).unwrap();
|
fs::remove_file(path).unwrap();
|
||||||
assert_eq!(content, "test");
|
assert_eq!(content, "test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ use core::{mem::ManuallyDrop, ptr::addr_of};
|
|||||||
#[cfg(target_vendor = "apple")]
|
#[cfg(target_vendor = "apple")]
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::{
|
use std::{
|
||||||
borrow::BorrowMut,
|
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
env,
|
env,
|
||||||
io::{Read, Write},
|
io::{Read, Write},
|
||||||
@ -225,8 +224,8 @@ where
|
|||||||
fn post_fork(&mut self, is_child: bool) -> Result<(), Error> {
|
fn post_fork(&mut self, is_child: bool) -> Result<(), Error> {
|
||||||
if is_child {
|
if is_child {
|
||||||
// After fork, only the parent keeps the join handle.
|
// After fork, only the parent keeps the join handle.
|
||||||
if let ShMemService::Started { bg_thread, .. } = &mut self.service {
|
if let ShMemService::Started { bg_thread, .. } = &self.service {
|
||||||
bg_thread.borrow_mut().lock().unwrap().join_handle = None;
|
bg_thread.lock().unwrap().join_handle = None;
|
||||||
}
|
}
|
||||||
//fn connect(&mut self) -> Result<Self, Error> {
|
//fn connect(&mut self) -> Result<Self, Error> {
|
||||||
//self.stream = UnixStream::connect_to_unix_addr(&UnixSocketAddr::new(UNIX_SERVER_NAME)?)?,
|
//self.stream = UnixStream::connect_to_unix_addr(&UnixSocketAddr::new(UNIX_SERVER_NAME)?)?,
|
||||||
@ -371,7 +370,7 @@ impl Drop for ShMemServiceThread {
|
|||||||
.expect("Error in ShMemService background thread!");
|
.expect("Error in ShMemService background thread!");
|
||||||
// try to remove the file from fs, and ignore errors.
|
// try to remove the file from fs, and ignore errors.
|
||||||
#[cfg(target_vendor = "apple")]
|
#[cfg(target_vendor = "apple")]
|
||||||
fs::remove_file(&UNIX_SERVER_NAME).unwrap();
|
fs::remove_file(UNIX_SERVER_NAME).unwrap();
|
||||||
|
|
||||||
env::remove_var(AFL_SHMEM_SERVICE_STARTED);
|
env::remove_var(AFL_SHMEM_SERVICE_STARTED);
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ pub mod tui;
|
|||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub mod disk;
|
pub mod disk;
|
||||||
#[cfg(feature = "introspection")]
|
|
||||||
use alloc::string::ToString;
|
|
||||||
use alloc::{fmt::Debug, string::String, vec::Vec};
|
use alloc::{fmt::Debug, string::String, vec::Vec};
|
||||||
use core::{fmt, time::Duration};
|
use core::{fmt, time::Duration};
|
||||||
|
|
||||||
@ -346,7 +344,7 @@ where
|
|||||||
(self.print_fn)(fmt);
|
(self.print_fn)(fmt);
|
||||||
|
|
||||||
// Separate the spacing just a bit
|
// Separate the spacing just a bit
|
||||||
(self.print_fn)("".to_string());
|
(self.print_fn)(String::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ token1="A\x41A"
|
|||||||
token2="B"
|
token2="B"
|
||||||
"###;
|
"###;
|
||||||
fs::write("test.tkns", data).expect("Unable to write test.tkns");
|
fs::write("test.tkns", data).expect("Unable to write test.tkns");
|
||||||
let tokens = Tokens::from_file(&"test.tkns").unwrap();
|
let tokens = Tokens::from_file("test.tkns").unwrap();
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
println!("Token file entries: {:?}", tokens.tokens());
|
println!("Token file entries: {:?}", tokens.tokens());
|
||||||
assert_eq!(tokens.tokens().len(), 2);
|
assert_eq!(tokens.tokens().len(), 2);
|
||||||
|
@ -436,7 +436,7 @@ where
|
|||||||
manager,
|
manager,
|
||||||
in_dir,
|
in_dir,
|
||||||
forced,
|
forced,
|
||||||
&mut |_, _, path| I::from_file(&path),
|
&mut |_, _, path| I::from_file(path),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
manager.fire(
|
manager.fire(
|
||||||
|
@ -92,7 +92,7 @@ fn exec_llvm_config(args: &[&str]) -> String {
|
|||||||
/// Use `xcrun` to get the path to the Xcode SDK tools library path, for linking
|
/// Use `xcrun` to get the path to the Xcode SDK tools library path, for linking
|
||||||
fn find_macos_sdk_libs() -> String {
|
fn find_macos_sdk_libs() -> String {
|
||||||
let sdk_path_out = Command::new("xcrun")
|
let sdk_path_out = Command::new("xcrun")
|
||||||
.args(&["--show-sdk-path"])
|
.arg("--show-sdk-path")
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to execute xcrun. Make sure you have Xcode installed and executed `sudo xcode-select --install`");
|
.expect("Failed to execute xcrun. Make sure you have Xcode installed and executed `sudo xcode-select --install`");
|
||||||
format!(
|
format!(
|
||||||
@ -129,7 +129,7 @@ fn build_pass(
|
|||||||
.args(cxxflags)
|
.args(cxxflags)
|
||||||
.arg(src_dir.join(src_file))
|
.arg(src_dir.join(src_file))
|
||||||
.args(ldflags)
|
.args(ldflags)
|
||||||
.args(&["-o"])
|
.arg("-o")
|
||||||
.arg(out_dir.join(format!("{}.{}", src_stub, dll_extension())))
|
.arg(out_dir.join(format!("{}.{}", src_stub, dll_extension())))
|
||||||
.status()
|
.status()
|
||||||
.unwrap_or_else(|_| panic!("Failed to compile {}", src_file))
|
.unwrap_or_else(|_| panic!("Failed to compile {}", src_file))
|
||||||
|
@ -377,7 +377,7 @@ impl ClangWrapper {
|
|||||||
optimize: true,
|
optimize: true,
|
||||||
wrapped_cc: CLANG_PATH.into(),
|
wrapped_cc: CLANG_PATH.into(),
|
||||||
wrapped_cxx: CLANGXX_PATH.into(),
|
wrapped_cxx: CLANGXX_PATH.into(),
|
||||||
name: "".into(),
|
name: String::new(),
|
||||||
is_cpp: false,
|
is_cpp: false,
|
||||||
linking: false,
|
linking: false,
|
||||||
shared: false,
|
shared: false,
|
||||||
|
@ -27,11 +27,11 @@ mod clone {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let mut cmd = Command::new("git");
|
let mut cmd = Command::new("git");
|
||||||
cmd.arg("clone").arg(url).arg(&path);
|
cmd.arg("clone").arg(url).arg(path);
|
||||||
let output = cmd.output().expect("failed to execute git clone");
|
let output = cmd.output().expect("failed to execute git clone");
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
let mut cmd = Command::new("git");
|
let mut cmd = Command::new("git");
|
||||||
cmd.arg("checkout").arg(commit).current_dir(&path);
|
cmd.arg("checkout").arg(commit).current_dir(path);
|
||||||
let output = cmd.output().expect("failed to execute git checkout");
|
let output = cmd.output().expect("failed to execute git checkout");
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
println!("failed to checkout symcc git repository commit:");
|
println!("failed to checkout symcc git repository commit:");
|
||||||
|
@ -97,7 +97,7 @@ fn main() {
|
|||||||
std::env::set_var(EXPRESSION_PRUNING, "1");
|
std::env::set_var(EXPRESSION_PRUNING, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = Command::new(&opt.program.first().expect("no program argument given"))
|
let res = Command::new(opt.program.first().expect("no program argument given"))
|
||||||
.args(opt.program.iter().skip(1))
|
.args(opt.program.iter().skip(1))
|
||||||
.status()
|
.status()
|
||||||
.expect("failed to spawn program");
|
.expect("failed to spawn program");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user