cxx/macro
David Tolnay 1565becf8d
Resolve manual_let_else clippy lint
warning: this could be rewritten as `let...else`
      --> gen/build/src/cargo.rs:54:13
       |
    54 | /             let k = match k.to_str() {
    55 | |                 Some(k) => k,
    56 | |                 None => continue,
    57 | |             };
       | |______________^ help: consider writing: `let Some(k) = k.to_str() else { continue };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
       = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic`
       = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]`

    warning: this could be rewritten as `let...else`
      --> gen/build/src/cargo.rs:58:13
       |
    58 | /             let v = match v.into_string() {
    59 | |                 Ok(v) => v,
    60 | |                 Err(_) => continue,
    61 | |             };
       | |______________^ help: consider writing: `let Ok(v) = v.into_string() else { continue };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
       --> gen/build/src/lib.rs:437:5
        |
    437 | /     let mut entries = match fs::read_dir(src) {
    438 | |         Ok(entries) => entries,
    439 | |         Err(_) => return,
    440 | |     };
        | |______^ help: consider writing: `let Ok(mut entries) = fs::read_dir(src) else { return };`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
       --> gen/build/src/out.rs:160:5
        |
    160 | /     let relative_path = match abstractly_relativize_symlink(original, link) {
    161 | |         Some(relative_path) => relative_path,
    162 | |         None => return original.to_path_buf(),
    163 | |     };
        | |______^ help: consider writing: `let Some(relative_path) = abstractly_relativize_symlink(original, link) else { return original.to_path_buf() };`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
       --> syntax/check.rs:558:9
        |
    558 | /         let resolve = match cx.types.try_resolve(&receiver.ty) {
    559 | |             Some(resolve) => resolve,
    560 | |             None => return,
    561 | |         };
        | |__________^ help: consider writing: `let Some(resolve) = cx.types.try_resolve(&receiver.ty) else { return };`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
        = note: `-W clippy::manual-let-else` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_let_else)]`

    warning: this could be rewritten as `let...else`
       --> syntax/parse.rs:439:5
        |
    439 | /     let name = match &abi.name {
    440 | |         Some(name) => name,
    441 | |         None => {
    442 | |             return Err(Error::new_spanned(
    ...   |
    446 | |         }
    447 | |     };
        | |______^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
    help: consider writing
        |
    439 ~     let Some(name) = &abi.name else {
    440 +             return Err(Error::new_spanned(
    441 +                 abi,
    442 +                 "ABI name is required, extern \"C++\" or extern \"Rust\"",
    443 +             ));
    444 +         };
        |

    warning: this could be rewritten as `let...else`
        --> syntax/parse.rs:1332:5
         |
    1332 | /     let len_expr = if let Expr::Lit(lit) = &ty.len {
    1333 | |         lit
    1334 | |     } else {
    1335 | |         let msg = "unsupported expression, array length must be an integer literal";
    1336 | |         return Err(Error::new_spanned(&ty.len, msg));
    1337 | |     };
         | |______^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
    help: consider writing
         |
    1332 ~     let Expr::Lit(len_expr) = &ty.len else {
    1333 +         let msg = "unsupported expression, array length must be an integer literal";
    1334 +         return Err(Error::new_spanned(&ty.len, msg));
    1335 +     };
         |

    warning: this could be rewritten as `let...else`
      --> syntax/report.rs:24:9
       |
    24 | /         let mut all_errors = match iter.next() {
    25 | |             Some(err) => err,
    26 | |             None => return Ok(()),
    27 | |         };
       | |__________^ help: consider writing: `let Some(mut all_errors) = iter.next() else { return Ok(()) };`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

    warning: this could be rewritten as `let...else`
       --> syntax/types.rs:174:13
        |
    174 | /             let impl_key = match ty.impl_key() {
    175 | |                 Some(impl_key) => impl_key,
    176 | |                 None => continue,
    177 | |             };
        | |______________^ help: consider writing: `let Some(impl_key) = ty.impl_key() else { continue };`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
2024-07-08 20:48:29 -07:00
..
src Resolve manual_let_else clippy lint 2024-07-08 20:48:29 -07:00
build.rs Factor out common symlink check build script 2020-10-11 02:36:16 -07:00
Cargo.toml Raise required compiler to rust 1.67 2024-07-08 20:38:37 -07:00
LICENSE-APACHE Link license files into subcrate packages 2020-03-07 11:18:11 -08:00
LICENSE-MIT Link license files into subcrate packages 2020-03-07 11:18:11 -08:00
README.md Split cxx runtime and build components 2020-04-29 18:23:14 -07:00

This directory contains CXX's Rust code generator, which is a procedural macro. Users won't depend on this crate directly. Instead they'll invoke its macro through the reexport in the main cxx crate.