Skip to content

stty: remove unnecessary mut from Vec - #15368

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:stty-vec
Open

oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:stty-vec

Conversation

@oech3

@oech3 oech3 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@oech3
oech3 force-pushed the stty-vec branch 2 times, most recently from 0e7664c to 6d8a405 Compare October 15, 2026 09:12
Comment thread src/uu/stty/src/stty.rs Outdated
fn combo_to_flags(combo: &str) -> Vec<ArgOptions<'_>> {
let mut flags = Vec::new();
let mut ccs = Vec::new();
let mut ccs: &[(S, &str)] = &[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could the match return a (flags, ccs) tuple so ccs doesn't need mut either?

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.

I avoided it since we need to have many &[].

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.

Applied. Diff is sad.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An alternative might be to separate the handling of flags and ccs, and move each into a function returning a Vec<ArgOptions>.

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.

I tried 2 match

@oech3
oech3 force-pushed the stty-vec branch 2 times, most recently from 4574fdf to 929b997 Compare October 15, 2026 13:16
@xtqqczze

This comment was marked as resolved.

This branch has not been deployed

No deployments
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.

4 participants