meta: appease clippy
parent
eb5b5370df
commit
b39b77aa5a
|
@ -211,10 +211,12 @@ impl<'a> Api<'a> {
|
|||
Self { agent, server }
|
||||
}
|
||||
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub fn http<T: DeserializeOwned>(&self, verb: &str, endpoint: &str) -> Result<T, ureq::Error> {
|
||||
self.request::<(), _>(verb, endpoint, None)
|
||||
}
|
||||
|
||||
#[allow(clippy::result_large_err)]
|
||||
pub fn http_form<S: Serialize, T: DeserializeOwned>(
|
||||
&self,
|
||||
verb: &str,
|
||||
|
@ -224,6 +226,7 @@ impl<'a> Api<'a> {
|
|||
self.request(verb, endpoint, Some(form))
|
||||
}
|
||||
|
||||
#[allow(clippy::result_large_err)]
|
||||
fn request<S: Serialize, T: DeserializeOwned>(
|
||||
&self,
|
||||
verb: &str,
|
||||
|
|
|
@ -266,7 +266,7 @@ impl HostsBuilder {
|
|||
|
||||
fn write_and_swap(temp_path: &Path, hosts_path: &Path, contents: &[u8]) -> io::Result<()> {
|
||||
// Copy the file we plan on modifying so its permissions and metadata are preserved.
|
||||
std::fs::copy(&hosts_path, &temp_path)?;
|
||||
std::fs::copy(hosts_path, temp_path)?;
|
||||
Self::write_clobber(temp_path, contents)?;
|
||||
std::fs::rename(temp_path, hosts_path)?;
|
||||
Ok(())
|
||||
|
|
|
@ -28,7 +28,7 @@ pub fn auto_migrate(conn: &rusqlite::Connection) -> Result<(), rusqlite::Error>
|
|||
}
|
||||
|
||||
if old_version != CURRENT_VERSION {
|
||||
conn.pragma_update(None, "user_version", &CURRENT_VERSION)?;
|
||||
conn.pragma_update(None, "user_version", CURRENT_VERSION)?;
|
||||
log::info!(
|
||||
"migrated db version from {} to {}",
|
||||
old_version,
|
||||
|
|
|
@ -16,11 +16,11 @@ fn create_database<P: AsRef<Path>>(
|
|||
database_path: P,
|
||||
) -> Result<Connection, Box<dyn std::error::Error>> {
|
||||
let conn = Connection::open(&database_path)?;
|
||||
conn.pragma_update(None, "foreign_keys", &1)?;
|
||||
conn.pragma_update(None, "foreign_keys", 1)?;
|
||||
conn.execute(db::peer::CREATE_TABLE_SQL, params![])?;
|
||||
conn.execute(db::association::CREATE_TABLE_SQL, params![])?;
|
||||
conn.execute(db::cidr::CREATE_TABLE_SQL, params![])?;
|
||||
conn.pragma_update(None, "user_version", &db::CURRENT_VERSION)?;
|
||||
conn.pragma_update(None, "user_version", db::CURRENT_VERSION)?;
|
||||
log::debug!("set database version to db::CURRENT_VERSION");
|
||||
|
||||
Ok(conn)
|
||||
|
|
|
@ -199,7 +199,7 @@ impl ConfigFile {
|
|||
path.display()
|
||||
);
|
||||
}
|
||||
Ok(toml::from_slice(&std::fs::read(&path).with_path(path)?)?)
|
||||
Ok(toml::from_slice(&std::fs::read(path).with_path(path)?)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ fn open_database_connection(
|
|||
|
||||
let conn = Connection::open(&database_path)?;
|
||||
// Foreign key constraints aren't on in SQLite by default. Enable.
|
||||
conn.pragma_update(None, "foreign_keys", &1)?;
|
||||
conn.pragma_update(None, "foreign_keys", 1)?;
|
||||
db::auto_migrate(&conn)?;
|
||||
Ok(conn)
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ fn get_listener(addr: SocketAddr, interface: &InterfaceName) -> Result<TcpListen
|
|||
/// See https://github.com/tonarino/innernet/issues/26 for more details.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn get_listener(addr: SocketAddr, _interface: &InterfaceName) -> Result<TcpListener, Error> {
|
||||
let listener = TcpListener::bind(&addr)?;
|
||||
let listener = TcpListener::bind(addr)?;
|
||||
listener.set_nonblocking(true)?;
|
||||
Ok(listener)
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ fn start_userspace_wireguard(iface: &InterfaceName) -> io::Result<Output> {
|
|||
"WG_TUN_NAME_FILE",
|
||||
&format!("{}/{}.name", VAR_RUN_PATH, iface),
|
||||
)
|
||||
.args(&["utun"])
|
||||
.args(["utun"])
|
||||
.output()?
|
||||
};
|
||||
if !output.status.success() {
|
||||
|
|
|
@ -79,7 +79,7 @@ impl Key {
|
|||
|
||||
/// Converts the key to a standardized base64 representation, as used by the `wg` utility and `wg-quick`.
|
||||
pub fn to_base64(&self) -> String {
|
||||
base64::encode(&self.0)
|
||||
base64::encode(self.0)
|
||||
}
|
||||
|
||||
/// Converts a base64 representation of the key to the raw bytes.
|
||||
|
|
Loading…
Reference in New Issue