Bump Rust version to 1.70.0 (#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
This commit is contained in:
Robin Malfait 2023-06-02 15:24:40 +02:00 • committed by GitHub
parent 9794b83985
commit b05b617601
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 8 deletions

View file

@ -61,6 +61,20 @@ jobs:
- name: Install dependencies
run: npm install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Check versions
run: |
echo "Node:" `node --version`
echo "NPM:" `npm --version`
echo "Rust:" `rustc --version`
echo "Cargo:" `cargo --version`
- name: Build Tailwind CSS
run: npx turbo run build --filter=//

View file

@ -73,6 +73,20 @@ jobs:
- name: Install dependencies
run: npm install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Check versions
run: |
echo "Node:" `node --version`
echo "NPM:" `npm --version`
echo "Rust:" `rustc --version`
echo "Cargo:" `cargo --version`
- name: Build Tailwind CSS
run: npx turbo run build --filter=//

View file

@ -53,6 +53,20 @@ jobs:
- name: Install dependencies
run: npm install
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Check versions
run: |
echo "Node:" `node --version`
echo "NPM:" `npm --version`
echo "Rust:" `rustc --version`
echo "Cargo:" `cargo --version`
- name: Build Tailwind CSS
run: npm run build

View file

@ -105,7 +105,7 @@ fn main() -> Result<(), std::io::Error> {
let candidates = content_paths.par_bridge().flat_map(|path| {
read_lines(path)
.unwrap()
.filter_map(Result::ok)
.map_while(Result::ok)
.par_bridge()
.flat_map_iter(|line| {
Extractor::unique(line.as_bytes(), Default::default())

View file

@ -11,7 +11,6 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let mut all_files: Vec<(u64, PathBuf)> = std::fs::read_dir(fixtures_path)
.unwrap()
.into_iter()
.filter_map(Result::ok)
.map(|dir_entry| dir_entry.path())
.filter(|path| path.is_file())

View file

@ -22,7 +22,6 @@ impl Candidate {
x == ':' && !in_arbitrary
}
})
.into_iter()
.collect::<Vec<_>>();
let utility = match parts.pop() {

View file

@ -12,7 +12,6 @@ pub fn fast_glob(
.follow_links(true)
.build()
.unwrap()
.into_iter()
.filter_map(Result::ok)
.map(|file| file.path().to_path_buf())
}))

View file

@ -43,7 +43,7 @@ pub fn resolve_content_paths(args: ContentPathInfo) -> Vec<String> {
let root = Path::new(&args.base);
let allowed_paths = FxHashSet::from_iter(
WalkBuilder::new(&root)
WalkBuilder::new(root)
.hidden(false)
.filter_entry(|entry| match entry.file_type() {
Some(file_type) if file_type.is_dir() => entry
@ -94,7 +94,7 @@ pub fn resolve_content_paths(args: ContentPathInfo) -> Vec<String> {
// Collect all valid paths from the root. This will already filter out ignored files, unknown
// extensions and binary files.
let mut it = WalkDir::new(&root)
let mut it = WalkDir::new(root)
// Sorting to make sure that we always see the directories before the files. Also sorting
// alphabetically by default.
.sort_by(

View file

@ -31,13 +31,13 @@ pub struct Extractor<'a> {
impl<'a> Extractor<'a> {
pub fn all(input: &'a [u8], opts: ExtractorOptions) -> Vec<&'a [u8]> {
Self::new(input, opts).into_iter().collect()
Self::new(input, opts).collect()
}
pub fn unique(input: &'a [u8], opts: ExtractorOptions) -> FxHashSet<&'a [u8]> {
let mut candidates: FxHashSet<&[u8]> = Default::default();
candidates.reserve(100);
candidates.extend(Self::new(input, opts).into_iter());
candidates.extend(Self::new(input, opts));
candidates
}