Browse Source

Format and clippy

master
Adrian Heine 3 years ago
parent
commit
bc4a898c0a
  1. 3
      src/lib.rs
  2. 2
      src/resources/mod.rs
  3. 2
      src/schema.rs
  4. 2
      src/storage.rs
  5. 12
      src/symbols/acme/user.rs
  6. 2
      src/symbols/dir.rs
  7. 1
      src/symbols/factory.rs
  8. 2
      src/symbols/file.rs
  9. 2
      src/symbols/hook.rs
  10. 10
      src/symbols/nginx/server.rs
  11. 1
      src/symbols/owner.rs
  12. 5
      src/symbols/systemd/user_service.rs

3
src/lib.rs

@ -7,7 +7,8 @@
unused_extern_crates,
unused_import_braces,
unused_qualifications,
variant_size_differences
variant_size_differences,
clippy::use_self
)]
#![warn(unused_results)]
/*

2
src/resources/mod.rs

@ -3,7 +3,7 @@ pub struct Resource(pub String, pub String);
impl<'a> Resource {
pub fn new<A: Into<String>, B: Into<String>>(rtype: A, value: B) -> Self {
Resource(rtype.into(), value.into())
Self(rtype.into(), value.into())
}
pub fn get_type(&self) -> &str {

2
src/schema.rs

@ -144,7 +144,7 @@ where
R: SymbolRunner,
{
pub fn new(symbol_runner: R) -> Self {
NonRepeatingSymbolRunner {
Self {
upstream: symbol_runner,
done: RefCell::new(HashSet::new()),
}

2
src/storage.rs

@ -14,7 +14,7 @@ pub struct SimpleStorage(String, String);
impl SimpleStorage {
pub fn new(base: String, filename: String) -> Self {
SimpleStorage(base, filename)
Self(base, filename)
}
fn get_path(&self, date: Option<u64>) -> String {

12
src/symbols/acme/user.rs

@ -18,17 +18,9 @@ pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str> + Clone,
let account_key_file = path("account.key");
List::from((
AcmeAccountKey::new(account_key_file.clone(), command_runner),
Owner::new(
account_key_file,
user_name.clone(),
command_runner,
),
Owner::new(account_key_file, user_name.clone(), command_runner),
Dir::new(path("challenges")),
Owner::new(
path("challenges"),
user_name.clone(),
command_runner,
),
Owner::new(path("challenges"), user_name.clone(), command_runner),
Dir::new("/etc/ssl/local_certs"),
Owner::new("/etc/ssl/local_certs", user_name, command_runner),
File::new(path("lets_encrypt_x3_cross_signed.pem"), cert),

2
src/symbols/dir.rs

@ -13,7 +13,7 @@ pub struct Dir<D: AsRef<Path>> {
impl<D: AsRef<Path>> Dir<D> {
pub fn new(path: D) -> Self {
Dir { path }
Self { path }
}
}

1
src/symbols/factory.rs

@ -1,5 +1,4 @@
use std::borrow::Cow;
use std::path::Path;
use std::path::PathBuf;

2
src/symbols/file.rs

@ -16,7 +16,7 @@ pub struct File<C: AsRef<str>, D: AsRef<Path>> {
impl<C: AsRef<str>, D: AsRef<Path>> File<C, D> {
pub fn new(path: D, content: C) -> Self {
File { path, content }
Self { path, content }
}
}

2
src/symbols/hook.rs

@ -20,7 +20,7 @@ where
B: Symbol,
{
pub fn new(a: A, b: B) -> Self {
Hook { a, b }
Self { a, b }
}
}

10
src/symbols/nginx/server.rs

@ -15,7 +15,7 @@ pub enum NginxServerError<E: Error> {
}
impl From<io::Error> for NginxServerError<io::Error> {
fn from(err: io::Error) -> NginxServerError<io::Error> {
fn from(err: io::Error) -> Self {
NginxServerError::ExecError(err)
}
}
@ -23,8 +23,8 @@ impl From<io::Error> for NginxServerError<io::Error> {
impl<E: Error> Error for NginxServerError<E> {
fn description(&self) -> &str {
match self {
NginxServerError::ExecError(ref e) => e.description(),
NginxServerError::GenericError => "Generic error",
Self::ExecError(ref e) => e.description(),
Self::GenericError => "Generic error",
}
}
fn cause(&self) -> Option<&dyn Error> {
@ -75,7 +75,7 @@ server {{
)
}
pub fn php_server_config_snippet<'a, SOCKET: AsRef<Path>, STATIC: AsRef<Path>>(
pub fn php_server_config_snippet<SOCKET: AsRef<Path>, STATIC: AsRef<Path>>(
socket_path: SOCKET,
static_path: STATIC,
) -> String {
@ -109,7 +109,7 @@ pub struct LocalTcpSocket(usize);
impl LocalTcpSocket {
pub fn new(x: usize) -> Self {
LocalTcpSocket(x)
Self(x)
}
}

1
src/symbols/owner.rs

@ -1,4 +1,3 @@
use std::error::Error;
use std::fmt;

5
src/symbols/systemd/user_service.rs

@ -3,7 +3,6 @@ use std::error::Error;
use std::ffi::OsStr;
use std::fmt;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::process::Output;
@ -23,8 +22,8 @@ pub enum UserServiceError<E: Error> {
}
impl From<io::Error> for UserServiceError<io::Error> {
fn from(err: io::Error) -> UserServiceError<io::Error> {
UserServiceError::ExecError(err)
fn from(err: io::Error) -> Self {
Self::ExecError(err)
}
}

Loading…
Cancel
Save