Skip to content

Commit 231808a

Browse files
committed
Apply cargo clippy
1 parent b95598e commit 231808a

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/cache.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn query(cache: &Connection, target: &str, commit: &str) -> Result<Option<bo
2424
let mut stmt = cache.prepare_cached(
2525
"SELECT is_parent FROM commits_cache WHERE target_commit = ?1 AND this_commit = ?2",
2626
)?;
27-
log::trace!("query cache: ({}, {})", target, commit);
27+
log::trace!("query cache: ({target}, {commit})");
2828
let query_result: Vec<bool> = stmt
2929
.query_map(params!(target, commit), |row| row.get(0))?
3030
.collect::<Result<_, _>>()?;
@@ -39,15 +39,15 @@ pub fn store(cache: &Connection, target: &str, commit: &str, hit: bool) -> Resul
3939
let mut stmt = cache.prepare_cached(
4040
"INSERT INTO commits_cache (target_commit, this_commit, is_parent) VALUES (?1, ?2, ?3)",
4141
)?;
42-
log::trace!("insert new cache: ({}, {}, {})", target, commit, hit);
42+
log::trace!("insert new cache: ({target}, {commit}, {hit})");
4343
let inserted = stmt.execute(params!(target, commit, hit))?;
4444
assert_eq!(inserted, 1);
4545
Ok(())
4646
}
4747

4848
pub fn remove(cache: &Connection, target: &str) -> Result<(), Error> {
4949
let mut stmt = cache.prepare_cached("DELETE FROM commits_cache WHERE target_commit = ?1")?;
50-
log::trace!("delete cache for target commit: {}", target);
50+
log::trace!("delete cache for target commit: {target}");
5151
stmt.execute(params!(target))?;
5252
Ok(())
5353
}

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ enum BCommand {
5555
}
5656

5757
async fn answer(bot: Bot, msg: Message, bc: BCommand) -> ResponseResult<()> {
58-
log::debug!("message: {:?}", msg);
59-
log::trace!("bot command: {:?}", bc);
58+
log::debug!("message: {msg:?}");
59+
log::trace!("bot command: {bc:?}");
6060
let BCommand::Notifier(input) = bc;
6161
let result = match command::parse(input) {
6262
Ok(command) => {
63-
log::debug!("command: {:?}", command);
63+
log::debug!("command: {command:?}");
6464
let (bot, msg) = (bot.clone(), msg.clone());
6565
match command {
6666
command::Notifier::RepoAdd { name, url } => repo_add(bot, msg, name, url).await,

src/repo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct ConditionCheckResult {
5151
}
5252

5353
pub async fn create(name: &str, path: PathBuf, url: &str) -> Result<Output, Error> {
54-
log::info!("try clone '{}' into {:?}", url, path);
54+
log::info!("try clone '{url}' into {path:?}");
5555

5656
let output = {
5757
let url = url.to_owned();
@@ -76,15 +76,15 @@ pub async fn create(name: &str, path: PathBuf, url: &str) -> Result<Output, Erro
7676
}
7777

7878
let _repo = Repository::open(&path)?;
79-
log::info!("cloned git repository {:?}", path);
79+
log::info!("cloned git repository {path:?}");
8080

8181
Ok(output)
8282
}
8383

8484
pub async fn fetch(resources: Arc<Resources>) -> Result<Output, Error> {
8585
let paths = &resources.paths;
8686
let repo_path = &paths.repo;
87-
log::info!("fetch {:?}", repo_path);
87+
log::info!("fetch {repo_path:?}");
8888

8989
let output = {
9090
let path = repo_path.clone();

src/repo/tasks.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ where
181181
T: Serialize + DeserializeOwned + Default,
182182
{
183183
if !path.as_ref().is_file() {
184-
log::info!("auto create file: {:?}", path);
184+
log::info!("auto create file: {path:?}");
185185
write_json::<_, T>(&path, &Default::default())?;
186186
}
187-
log::debug!("read from file: {:?}", path);
187+
log::debug!("read from file: {path:?}");
188188
let file = File::open(path)?;
189189
// TODO lock_shared maybe added to the std lib in the future
190190
FileExt::lock_shared(&file)?; // close of file automatically release the lock
@@ -197,7 +197,7 @@ where
197197
P: AsRef<Path> + fmt::Debug,
198198
T: Serialize,
199199
{
200-
log::debug!("write to file: {:?}", path);
200+
log::debug!("write to file: {path:?}");
201201
let file = OpenOptions::new()
202202
.write(true)
203203
.create(true)

0 commit comments

Comments
 (0)