if n % 7 == 0 ...
fn main() -> Result<()> let re = Regex::new(r"\d+")?; println!("Found numbers: :?", re.find_all("a1 b2 c3")); Ok(())
Temporarily building an older crate that declares rust-version = "1.80" while you’re on 1.75 . rust devblog 261
#!/usr/bin/env cargo-script //! ```cargo //! [dependencies] //! regex = "1.10" //! anyhow = "1.0" //! ``` use regex::Regex; use anyhow::Result;
// In your proc macro #[proc_macro] pub fn my_macro(input: TokenStream) -> TokenStream let diag = Diagnostic::new(Severity::Error, "This usage is invalid") .help("Try using `foo` instead of `bar`") .emit(); // ... if n % 7 == 0
cargo script script.rs Add #!/usr/bin/env cargo-script shebang and chmod +x for executable scripts. 4. Standard library: integer::is_multiple_of What’s new: New method is_multiple_of on integer types.
Better error messages for your macro users. ```cargo //
If you use #![deny(clippy::pedantic)] or custom lints, they are now more predictable.
error: This usage is invalid --> src/main.rs:3:1 | 3 | my_macro!(bar); | ^^^^^^^^^^^^^^ help: Try using `foo` instead of `bar` Use span methods to point exactly at the problematic token. 2. Lint stability: #[stable] for lints What’s new: Lints can now be marked stable, meaning they won’t change behavior without an edition bump.
if n.is_multiple_of(7) ...