Skip to content

ln: remove panic in result function#12257

Open
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:ln-panic-in-result-fn
Open

ln: remove panic in result function#12257
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:ln-panic-in-result-fn

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented May 12, 2026

files.is_empty() should not occur for uu_ln due to clap, but the function is exposed in a public API and used by nushell.

found using clippy::panic_in_result_fn

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@xtqqczze xtqqczze force-pushed the ln-panic-in-result-fn branch from 863fe48 to 7d3e164 Compare May 12, 2026 12:20
@xtqqczze

This comment was marked as outdated.

found using `clippy::panic_in_result_fn`
@xtqqczze xtqqczze force-pushed the ln-panic-in-result-fn branch from 7d3e164 to b8fd24e Compare May 12, 2026 12:48
@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 12, 2026

match files.len()

Comment thread src/uu/ln/src/ln.rs
uucore::execution_phrase().to_string(),
));
}
assert!(!files.is_empty());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match files.len()

I considered a match but wanted to move the check to the start of the function.

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 12, 2026

Does empty files logically happen? Or blocked by clap?

@xtqqczze
Copy link
Copy Markdown
Contributor Author

Does empty files logically happen? Or blocked by clap?

Updated the description to explain.

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 12, 2026

I don't like to have double check to support external project. But I have no idea about better solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants