fix(cli): use map_or_else when loading managed sessions

Resolves clippy::map_unwrap_or in main.rs.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-02 15:03:02 +09:00
parent 29b99b21f7
commit e9a571ae57
+11 -12
View File
@@ -2058,7 +2058,17 @@ fn list_managed_sessions() -> Result<Vec<ManagedSessionSummary>, Box<dyn std::er
.map(|duration| duration.as_secs())
.unwrap_or_default();
let (id, message_count, parent_session_id, branch_name) = Session::load_from_path(&path)
.map(|session| {
.map_or_else(|_| {
(
path.file_stem()
.and_then(|value| value.to_str())
.unwrap_or("unknown")
.to_string(),
0,
None,
None,
)
}, |session| {
let parent_session_id = session
.fork
.as_ref()
@@ -2073,17 +2083,6 @@ fn list_managed_sessions() -> Result<Vec<ManagedSessionSummary>, Box<dyn std::er
parent_session_id,
branch_name,
)
})
.unwrap_or_else(|_| {
(
path.file_stem()
.and_then(|value| value.to_str())
.unwrap_or("unknown")
.to_string(),
0,
None,
None,
)
});
sessions.push(ManagedSessionSummary {
id,