mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tr: lazily generate the character mapping as necessary
This commit is contained in:
parent
727101ccf3
commit
4712015e61
1 changed files with 1 additions and 1 deletions
|
@ -129,11 +129,11 @@ impl Sequence {
|
|||
truncate_set1_flag: bool,
|
||||
) -> Result<(Vec<u8>, Vec<u8>), BadSequence> {
|
||||
let set1 = Self::from_str(set1_str)?;
|
||||
let set2 = Self::from_str(set2_str)?;
|
||||
|
||||
let is_char_star = |s: &&Self| -> bool { matches!(s, Self::CharStar(_)) };
|
||||
let set1_star_count = set1.iter().filter(is_char_star).count();
|
||||
if set1_star_count == 0 {
|
||||
let set2 = Self::from_str(set2_str)?;
|
||||
let set2_star_count = set2.iter().filter(is_char_star).count();
|
||||
if set2_star_count < 2 {
|
||||
let char_star = set2.iter().find_map(|s| match s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue