Skip to content

Commit 6b4eee6

Browse files
committed
fix(clippy): resolve all clippy warnings in CI
- Remove unused lifetime parameters in cache and world modules - Replace io::Error::new with io::Error::other for cleaner API - Use next_back() instead of last() for double-ended iterators - Remove needless return statement in GitHub provider - Add explicit lifetime annotations to ConfigListViewer - Fix test URL from httpbin.org to mockhttp.org to avoid 503 errors
1 parent 2b94f24 commit 6b4eee6

File tree

8 files changed

+8
-11
lines changed

8 files changed

+8
-11
lines changed

src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ pub async fn init_cache_manager_with_expire(local_cache_path: &Path, expire_time
2929
.set_global_expire_time(expire_time);
3030
}
3131

32-
pub async fn get_cache_manager<'a>() -> Arc<Mutex<CacheManager>> {
32+
pub async fn get_cache_manager() -> Arc<Mutex<CacheManager>> {
3333
INSTANCE_CONTAINER.get().await.clone()
3434
}

src/core/config/world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub async fn init_world_list(world_list_path: &Path) -> Result<()> {
1818
Ok(())
1919
}
2020

21-
pub async fn get_world_list<'a>() -> Arc<Mutex<WorldList>> {
21+
pub async fn get_world_list() -> Arc<Mutex<WorldList>> {
2222
INSTANCE_CONTAINER.get().await.clone()
2323
}
2424

src/utils/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ mod tests {
256256

257257
#[tokio::test]
258258
async fn test_https_get_status() {
259-
let url = "https://httpbin.org/status/418".parse().unwrap();
259+
let url = "https://mockhttp.org/status/418".parse().unwrap();
260260
let result = https_get(url, &HashMap::new()).await;
261261
assert_eq!(result.unwrap().status, 418);
262262
}

src/websdk/cloud_rules/cloud_rules_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl CloudRules {
3030
}
3131
}
3232

33-
pub fn get_config_list(&self) -> ConfigListViewer {
33+
pub fn get_config_list(&self) -> ConfigListViewer<'_> {
3434
self._config_list
3535
.as_ref()
3636
.map_or_else(ConfigListViewer::default, |config_list| {

src/websdk/cloud_rules/data/config_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct ConfigList {
3232
}
3333

3434
impl ConfigList {
35-
pub fn viewer(&self) -> ConfigListViewer {
35+
pub fn viewer(&self) -> ConfigListViewer<'_> {
3636
ConfigListViewer {
3737
app_config_list: self.app_config_list.iter().collect(),
3838
hub_config_list: self.hub_config_list.iter().collect(),

src/websdk/repo/provider/base_provider.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ impl<T> FOut<T> {
9595

9696
pub fn new_empty() -> Self {
9797
FOut {
98-
result: Err(Box::new(std::io::Error::new(
99-
std::io::ErrorKind::Other,
100-
"no data",
101-
))),
98+
result: Err(Box::new(std::io::Error::other("no data"))),
10299
cached_map: None,
103100
}
104101
}

src/websdk/repo/provider/fdroid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl FDroidProvider {
158158
};
159159
}
160160
let download_url = format!("{}/{}", url, file_name);
161-
let file_type = file_name.split('.').last().unwrap_or("").to_string();
161+
let file_type = file_name.split('.').next_back().unwrap_or("").to_string();
162162

163163
let extra = if extra.is_empty() { None } else { Some(extra) };
164164
Ok(ReleaseData {

src/websdk/repo/provider/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl GitHubProvider {
3636
if let Some(token) = token {
3737
map.insert("Authorization".to_string(), format!("Bearer {}", token));
3838
}
39-
return map;
39+
map
4040
}
4141
}
4242

0 commit comments

Comments
 (0)