Skip to content

Commit b05b617

Browse files
authored
Bump Rust version to 1.70.0 (tailwindlabs#11344)
* `cargo clippy --fix` * use `map_while` instead of `filter_map` - `filter_map()` will run forever if the iterator repeatedly produces an `Err` ``` ❯ cargo clippy Checking tailwindcss-oxide v0.1.0 (/Users/robin/github.com/tailwindlabs/tailwindcss/oxide/crates/cli) warning: `filter_map()` will run forever if the iterator repeatedly produces an `Err` --> crates/cli/src/main.rs:108:14 | 108 | .filter_map(Result::ok) | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> crates/cli/src/main.rs:106:9 | 106 | / read_lines(path) 107 | | .unwrap() | |_____________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok = note: `#[warn(clippy::lines_filter_map_ok)]` on by default warning: `tailwindcss-oxide` (bin "tailwindcss-oxide") generated 1 warning Finished dev [unoptimized + debuginfo] target(s) in 0.13s ``` * log used versions of all the tools we are using * ensure we install Rust
1 parent 9794b83 commit b05b617

File tree

9 files changed

+47
-8
lines changed

9 files changed

+47
-8
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ jobs:
6161
- name: Install dependencies
6262
run: npm install
6363

64+
- name: Install Rust
65+
uses: actions-rs/toolchain@v1
66+
with:
67+
toolchain: stable
68+
profile: minimal
69+
override: true
70+
71+
- name: Check versions
72+
run: |
73+
echo "Node:" `node --version`
74+
echo "NPM:" `npm --version`
75+
echo "Rust:" `rustc --version`
76+
echo "Cargo:" `cargo --version`
77+
6478
- name: Build Tailwind CSS
6579
run: npx turbo run build --filter=//
6680

.github/workflows/integration-tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ jobs:
7373
- name: Install dependencies
7474
run: npm install
7575

76+
- name: Install Rust
77+
uses: actions-rs/toolchain@v1
78+
with:
79+
toolchain: stable
80+
profile: minimal
81+
override: true
82+
83+
- name: Check versions
84+
run: |
85+
echo "Node:" `node --version`
86+
echo "NPM:" `npm --version`
87+
echo "Rust:" `rustc --version`
88+
echo "Cargo:" `cargo --version`
89+
7690
- name: Build Tailwind CSS
7791
run: npx turbo run build --filter=//
7892

.github/workflows/prepare-release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ jobs:
5353
- name: Install dependencies
5454
run: npm install
5555

56+
- name: Install Rust
57+
uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: stable
60+
profile: minimal
61+
override: true
62+
63+
- name: Check versions
64+
run: |
65+
echo "Node:" `node --version`
66+
echo "NPM:" `npm --version`
67+
echo "Rust:" `rustc --version`
68+
echo "Cargo:" `cargo --version`
69+
5670
- name: Build Tailwind CSS
5771
run: npm run build
5872

oxide/crates/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn main() -> Result<(), std::io::Error> {
105105
let candidates = content_paths.par_bridge().flat_map(|path| {
106106
read_lines(path)
107107
.unwrap()
108-
.filter_map(Result::ok)
108+
.map_while(Result::ok)
109109
.par_bridge()
110110
.flat_map_iter(|line| {
111111
Extractor::unique(line.as_bytes(), Default::default())

oxide/crates/core/benches/parse_candidate_strings.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1111

1212
let mut all_files: Vec<(u64, PathBuf)> = std::fs::read_dir(fixtures_path)
1313
.unwrap()
14-
.into_iter()
1514
.filter_map(Result::ok)
1615
.map(|dir_entry| dir_entry.path())
1716
.filter(|path| path.is_file())

oxide/crates/core/src/candidate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ impl Candidate {
2222
x == ':' && !in_arbitrary
2323
}
2424
})
25-
.into_iter()
2625
.collect::<Vec<_>>();
2726

2827
let utility = match parts.pop() {

oxide/crates/core/src/glob.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub fn fast_glob(
1212
.follow_links(true)
1313
.build()
1414
.unwrap()
15-
.into_iter()
1615
.filter_map(Result::ok)
1716
.map(|file| file.path().to_path_buf())
1817
}))

oxide/crates/core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn resolve_content_paths(args: ContentPathInfo) -> Vec<String> {
4343
let root = Path::new(&args.base);
4444

4545
let allowed_paths = FxHashSet::from_iter(
46-
WalkBuilder::new(&root)
46+
WalkBuilder::new(root)
4747
.hidden(false)
4848
.filter_entry(|entry| match entry.file_type() {
4949
Some(file_type) if file_type.is_dir() => entry
@@ -94,7 +94,7 @@ pub fn resolve_content_paths(args: ContentPathInfo) -> Vec<String> {
9494

9595
// Collect all valid paths from the root. This will already filter out ignored files, unknown
9696
// extensions and binary files.
97-
let mut it = WalkDir::new(&root)
97+
let mut it = WalkDir::new(root)
9898
// Sorting to make sure that we always see the directories before the files. Also sorting
9999
// alphabetically by default.
100100
.sort_by(

oxide/crates/core/src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ pub struct Extractor<'a> {
3131

3232
impl<'a> Extractor<'a> {
3333
pub fn all(input: &'a [u8], opts: ExtractorOptions) -> Vec<&'a [u8]> {
34-
Self::new(input, opts).into_iter().collect()
34+
Self::new(input, opts).collect()
3535
}
3636

3737
pub fn unique(input: &'a [u8], opts: ExtractorOptions) -> FxHashSet<&'a [u8]> {
3838
let mut candidates: FxHashSet<&[u8]> = Default::default();
3939
candidates.reserve(100);
40-
candidates.extend(Self::new(input, opts).into_iter());
40+
candidates.extend(Self::new(input, opts));
4141
candidates
4242
}
4343

0 commit comments

Comments
 (0)