Clippy
This commit is contained in:
parent
0d41e8a833
commit
4eeb280f0d
21 changed files with 44 additions and 44 deletions
|
|
@ -17,7 +17,7 @@ pub struct Checkout<_C, C, P, S, B> {
|
|||
phantom: PhantomData<_C>,
|
||||
}
|
||||
|
||||
impl<C, _C, P, S, B> Checkout<_C, C, P, S, B> {
|
||||
impl<_C, C, P, S, B> Checkout<_C, C, P, S, B> {
|
||||
pub fn new(target: P, source: S, branch: B, command_runner: C) -> Self {
|
||||
Self {
|
||||
target,
|
||||
|
|
@ -29,7 +29,7 @@ impl<C, _C, P, S, B> Checkout<_C, C, P, S, B> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<C: CommandRunner, _C: Borrow<C>, P: AsRef<Path>, S, B> Checkout<C, _C, P, S, B> {
|
||||
impl<_C: CommandRunner, C: Borrow<_C>, P: AsRef<Path>, S, B> Checkout<_C, C, P, S, B> {
|
||||
async fn run_git(&self, args: &[impl AsRef<OsStr>]) -> Result<Vec<u8>, Box<dyn Error>> {
|
||||
let mut new_args = Vec::with_capacity(args.len() + 2);
|
||||
new_args.extend_from_slice(args!["-C", self.target.as_ref()]);
|
||||
|
|
@ -43,8 +43,8 @@ impl<C: CommandRunner, _C: Borrow<C>, P: AsRef<Path>, S, B> Checkout<C, _C, P, S
|
|||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
impl<C: CommandRunner, _C: Borrow<C>, P: AsRef<Path>, S: AsRef<str>, B: AsRef<str>> Symbol
|
||||
for Checkout<C, _C, P, S, B>
|
||||
impl<_C: CommandRunner, C: Borrow<_C>, P: AsRef<Path>, S: AsRef<str>, B: AsRef<str>> Symbol
|
||||
for Checkout<_C, C, P, S, B>
|
||||
{
|
||||
async fn target_reached(&self) -> Result<bool, Box<dyn Error>> {
|
||||
if !self.target.as_ref().exists() {
|
||||
|
|
@ -146,7 +146,6 @@ mod test {
|
|||
["-C", "target", "rev-list", "-1", "HEAD"],
|
||||
]
|
||||
);
|
||||
drop(first_two_args);
|
||||
assert_eq!(args[2], ["-C", "target", "rev-list", "-1", "FETCH_HEAD"]);
|
||||
|
||||
assert!((end - start).as_millis() >= 100);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub struct Database<'a, D, S, C> {
|
|||
}
|
||||
|
||||
impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> {
|
||||
pub fn new(db_name: D, seed_file: S, command_runner: &'a C) -> Self {
|
||||
pub const fn new(db_name: D, seed_file: S, command_runner: &'a C) -> Self {
|
||||
Self {
|
||||
db_name,
|
||||
seed_file,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ pub struct Dump<'a, N, C, S> {
|
|||
}
|
||||
|
||||
impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> {
|
||||
pub fn new(db_name: N, storage: S, command_runner: &'a C) -> Self {
|
||||
pub const fn new(db_name: N, storage: S, command_runner: &'a C) -> Self {
|
||||
Self {
|
||||
db_name,
|
||||
storage,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pub struct User<'a, U, C> {
|
|||
}
|
||||
|
||||
impl<'a, U: AsRef<str>, C: CommandRunner> User<'a, U, C> {
|
||||
pub fn new(user_name: U, command_runner: &'a C) -> Self {
|
||||
pub const fn new(user_name: U, command_runner: &'a C) -> Self {
|
||||
Self {
|
||||
user_name,
|
||||
command_runner,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub struct Install<'a, T: AsRef<Path>, C: CommandRunner> {
|
|||
}
|
||||
|
||||
impl<'a, T: AsRef<Path>, C: CommandRunner> Install<'a, T, C> {
|
||||
pub fn new(target: T, command_runner: &'a C) -> Self {
|
||||
pub const fn new(target: T, command_runner: &'a C) -> Self {
|
||||
Self {
|
||||
target,
|
||||
command_runner,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub struct PostgreSQLDatabase<'a, N: AsRef<str>, S: AsRef<str>, C: CommandRunner
|
|||
}
|
||||
|
||||
impl<'a, N: AsRef<str>, S: AsRef<str>, C: CommandRunner> PostgreSQLDatabase<'a, N, S, C> {
|
||||
pub fn new(name: N, seed_file: S, command_runner: &'a C) -> Self {
|
||||
pub const fn new(name: N, seed_file: S, command_runner: &'a C) -> Self {
|
||||
PostgreSQLDatabase {
|
||||
name,
|
||||
seed_file,
|
||||
|
|
@ -25,7 +25,7 @@ impl<'a, N: AsRef<str>, S: AsRef<str>, C: CommandRunner> PostgreSQLDatabase<'a,
|
|||
.command_runner
|
||||
.get_output(
|
||||
"su",
|
||||
args!["-", "postgres", "-c", format!("psql -t -c \"{}\"", sql)],
|
||||
args!["-", "postgres", "-c", format!("psql -t -c \"{sql}\"")],
|
||||
)
|
||||
.await?;
|
||||
Ok(String::from_utf8(b)?)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use std::marker::PhantomData;
|
|||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum StorageDirection {
|
||||
Load,
|
||||
Store,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub struct UserService<'a, S: AsRef<Path>, U: AsRef<str>> {
|
|||
}
|
||||
|
||||
impl<S: AsRef<Path>, U: AsRef<str>> UserService<'static, S, U> {
|
||||
pub fn new(socket_path: S, user_name: U, service_name: &'static str) -> Self {
|
||||
pub const fn new(socket_path: S, user_name: U, service_name: &'static str) -> Self {
|
||||
Self {
|
||||
socket_path,
|
||||
service_name,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub struct Plugin<'a, P, N, R> {
|
|||
}
|
||||
|
||||
impl<'a, P: AsRef<Path>, N: AsRef<str>, R: CommandRunner> Plugin<'a, P, N, R> {
|
||||
pub fn new(base: P, name: N, command_runner: &'a R) -> Self {
|
||||
pub const fn new(base: P, name: N, command_runner: &'a R) -> Self {
|
||||
Self {
|
||||
base,
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub struct Translation<'a, C, D, R> {
|
|||
}
|
||||
|
||||
impl<'a, D, C: AsRef<str>, R: CommandRunner> Translation<'a, C, D, R> {
|
||||
pub fn new(path: D, version: &'a str, locale: C, command_runner: &'a R) -> Self {
|
||||
pub const fn new(path: D, version: &'a str, locale: C, command_runner: &'a R) -> Self {
|
||||
Self {
|
||||
path,
|
||||
version,
|
||||
|
|
@ -33,7 +33,7 @@ impl<C: AsRef<str>, D: AsRef<Path>, R: CommandRunner> Translation<'_, C, D, R> {
|
|||
fn get_pairs(&self) -> Vec<(String, PathBuf)> {
|
||||
let version_x = self
|
||||
.version
|
||||
.trim_end_matches(|c: char| c.is_digit(10))
|
||||
.trim_end_matches(|c: char| c.is_ascii_digit())
|
||||
.to_owned()
|
||||
+ "x";
|
||||
let locale = self.locale.as_ref();
|
||||
|
|
@ -51,7 +51,7 @@ impl<C: AsRef<str>, D: AsRef<Path>, R: CommandRunner> Translation<'_, C, D, R> {
|
|||
] {
|
||||
for format in &["po", "mo"] {
|
||||
res.push((
|
||||
format!("https://translate.wordpress.org/projects/wp/{}/{}{}/default/export-translations?format={}", version_x, in_slug, path_locale, format),
|
||||
format!("https://translate.wordpress.org/projects/wp/{version_x}/{in_slug}{path_locale}/default/export-translations?format={format}"),
|
||||
[self.path.as_ref(), format!("{}{}.{}", out_slug, self.locale.as_ref(), format).as_ref()].iter().collect()
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue