style: fix cargo fmt formatting issues in ascii and system modules
Swadhin Biswas committed 7 months ago
a86ab2f
1 parent 55ea99a
commit a86ab2f
2 files changed
+68 -18
Showing 2 changed files+68-18
▼src/ascii/mod.rs
+59-11
| @@ -1575,17 +1575,65 @@ mod tests { | ||
1575 | 1575 | #[test] |
1576 | 1576 | fn test_all_distros_have_art() { |
1577 | 1577 | let distros = [ |
1578 | - "arch", "ubuntu", "debian", "fedora", "gentoo", "opensuse", | |
1579 | - "manjaro", "void", "nixos", "pop", "linuxmint", "alpine", | |
1580 | - "cachyos", "endeavouros", "artix", "garuda", "kali", "centos", | |
1581 | - "rocky", "alma", "slackware", "zorin", "elementary", "mx", | |
1582 | - "solus", "deepin", "raspbian", "freebsd", "openbsd", "macos", | |
1583 | - "windows", "android", "rhel", "amazon", "chromeos", "bedrock", | |
1584 | - "clearlinux", "crux", "devuan", "dragonfly", "endless", | |
1585 | - "exherbo", "guix", "haiku", "hyperbola", "instantos", "mageia", | |
1586 | - "netbsd", "parabola", "parrot", "peppermint", "porteus", | |
1587 | - "postmarketos", "puppy", "pureos", "sabayon", "slitaz", | |
1588 | - "tails", "trisquel", | |
1578 | + "arch", | |
1579 | + "ubuntu", | |
1580 | + "debian", | |
1581 | + "fedora", | |
1582 | + "gentoo", | |
1583 | + "opensuse", | |
1584 | + "manjaro", | |
1585 | + "void", | |
1586 | + "nixos", | |
1587 | + "pop", | |
1588 | + "linuxmint", | |
1589 | + "alpine", | |
1590 | + "cachyos", | |
1591 | + "endeavouros", | |
1592 | + "artix", | |
1593 | + "garuda", | |
1594 | + "kali", | |
1595 | + "centos", | |
1596 | + "rocky", | |
1597 | + "alma", | |
1598 | + "slackware", | |
1599 | + "zorin", | |
1600 | + "elementary", | |
1601 | + "mx", | |
1602 | + "solus", | |
1603 | + "deepin", | |
1604 | + "raspbian", | |
1605 | + "freebsd", | |
1606 | + "openbsd", | |
1607 | + "macos", | |
1608 | + "windows", | |
1609 | + "android", | |
1610 | + "rhel", | |
1611 | + "amazon", | |
1612 | + "chromeos", | |
1613 | + "bedrock", | |
1614 | + "clearlinux", | |
1615 | + "crux", | |
1616 | + "devuan", | |
1617 | + "dragonfly", | |
1618 | + "endless", | |
1619 | + "exherbo", | |
1620 | + "guix", | |
1621 | + "haiku", | |
1622 | + "hyperbola", | |
1623 | + "instantos", | |
1624 | + "mageia", | |
1625 | + "netbsd", | |
1626 | + "parabola", | |
1627 | + "parrot", | |
1628 | + "peppermint", | |
1629 | + "porteus", | |
1630 | + "postmarketos", | |
1631 | + "puppy", | |
1632 | + "pureos", | |
1633 | + "sabayon", | |
1634 | + "slitaz", | |
1635 | + "tails", | |
1636 | + "trisquel", | |
1589 | 1637 | ]; |
1590 | 1638 | for distro in &distros { |
1591 | 1639 | let art = get_ascii(distro); |
1592 | 1640 | |
▼src/system/mod.rs
+9-7
| @@ -531,12 +531,18 @@ fn get_resolution() -> String { | ||
531 | 531 | while i < chars.len() { |
532 | 532 | if out[i..].starts_with("\"width\":") { |
533 | 533 | let w_start = i + 8; |
534 | - let w_str: String = out[w_start..].chars().take_while(|c| c.is_ascii_digit() || *c == ' ').collect(); | |
534 | + let w_str: String = out[w_start..] | |
535 | + .chars() | |
536 | + .take_while(|c| c.is_ascii_digit() || *c == ' ') | |
537 | + .collect(); | |
535 | 538 | let width = w_str.trim().parse::<u32>().unwrap_or(0); |
536 | 539 | // Find the next "height": |
537 | 540 | if let Some(h_pos) = out[w_start..].find("\"height\":") { |
538 | 541 | let h_start = w_start + h_pos + 9; |
539 | - let h_str: String = out[h_start..].chars().take_while(|c| c.is_ascii_digit() || *c == ' ').collect(); | |
542 | + let h_str: String = out[h_start..] | |
543 | + .chars() | |
544 | + .take_while(|c| c.is_ascii_digit() || *c == ' ') | |
545 | + .collect(); | |
540 | 546 | let height = h_str.trim().parse::<u32>().unwrap_or(0); |
541 | 547 | if width > 0 && height > 0 { |
542 | 548 | resolutions.push(format!("{}x{}", width, height)); |
| @@ -1028,11 +1034,7 @@ fn get_cpu() -> String { | ||
1028 | 1034 | let mut speed_khz: u64 = 0; |
1029 | 1035 | |
1030 | 1036 | if Path::new(speed_dir).is_dir() { |
1031 | - for file in &[ | |
1032 | - "bios_limit", | |
1033 | - "scaling_max_freq", | |
1034 | - "cpuinfo_max_freq", | |
1035 | - ] { | |
1037 | + for file in &["bios_limit", "scaling_max_freq", "cpuinfo_max_freq"] { | |
1036 | 1038 | let path = format!("{}/{}", speed_dir, file); |
1037 | 1039 | let val = read_first_line(&path); |
1038 | 1040 | if let Ok(khz) = val.parse::<u64>() { |
1039 | 1041 | |