Skip to content

Commit 9fe3e8a

Browse files
committed
Run clippy in CI
1 parent 2754fc0 commit 9fe3e8a

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ jobs:
1717
cargo fmt -- --version
1818
cargo fmt --all -- --check
1919
20+
clippy:
21+
runs-on: ubuntu-24.04
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Run clippy
26+
run: |
27+
cargo clippy -- --version
28+
cargo clippy --all --all-targets -- -Dwarnings
29+
2030
build:
2131
strategy:
2232
matrix:

src/game_settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ fn local_path(game_id: GameId, game_path: &Path) -> Result<Option<PathBuf>, Erro
343343
#[cfg(not(windows))]
344344
fn local_path(game_id: GameId, game_path: &Path) -> Result<Option<PathBuf>, Error> {
345345
if game_id == GameId::OpenMW {
346-
return openmw_config::user_config_dir(game_path).map(Some);
346+
openmw_config::user_config_dir(game_path).map(Some)
347347
} else if appdata_folder_name(game_id, game_path).is_none() {
348348
// There is no local path, the value doesn't matter.
349349
Ok(None)

src/ini.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ fn get_windows_system_language() -> Result<Option<String>, Error> {
260260
}
261261

262262
#[cfg(not(windows))]
263+
#[expect(clippy::unnecessary_wraps, reason = "To match the Windows function signature")]
263264
fn get_windows_system_language() -> Result<Option<String>, Error> {
264265
Ok(None)
265266
}

src/openmw_config.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn default_user_config_dir(game_path: &Path) -> Result<PathBuf, Error> {
110110
// as part of a Flatpak app.
111111
std::env::var_os("HOST_XDG_CONFIG_HOME")
112112
.and_then(is_absolute_path)
113-
.or_else(|| dirs::config_dir())
113+
.or_else(dirs::config_dir)
114114
.map(|p| p.join("openmw"))
115115
}
116116
.ok_or_else(|| Error::NoUserConfigPath)
@@ -126,7 +126,7 @@ fn default_user_data_dir(is_flatpak_install: bool) -> Result<PathBuf, Error> {
126126
// running as part of a Flatpak app.
127127
std::env::var_os("HOST_XDG_DATA_HOME")
128128
.and_then(is_absolute_path)
129-
.or_else(|| dirs::data_local_dir())
129+
.or_else(dirs::data_local_dir)
130130
.map(|p| p.join("openmw"))
131131
}
132132
.ok_or_else(|| Error::NoUserDataPath)
@@ -235,11 +235,7 @@ fn default_global_data_dir(game_path: &Path) -> PathBuf {
235235
#[cfg(not(windows))]
236236
fn is_absolute_path(value: OsString) -> Option<PathBuf> {
237237
let path = PathBuf::from(value);
238-
if path.is_absolute() {
239-
Some(path)
240-
} else {
241-
None
242-
}
238+
path.is_absolute().then_some(path)
243239
}
244240

245241
#[cfg(not(windows))]

0 commit comments

Comments
 (0)