• thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    22 天前

    Yeah. Lot of people also use Ai generated code… so…

    I have tested if clippy would warn me with a simple example (generates 6.7gb memory usage, be careful not to crash your computer if you add another 0…), while I watch with a system monitor (in KDE):

    use std::thread;
    use std::time;
    
    fn main() {
        let mut vec = Vec::new(); // Create an empty Vector.
    
        for number in 0..900000000 {
            let bign: i64 = number * number;
            vec.push(bign);
        }
    
        thread::sleep(time::Duration::from_secs(10));
    }
    

    I used the pedantic option of clippy and the only thing it complained was about the notation of the number…:

    $ cargo clippy -- -W clippy::pedantic
    warning: long literal lacking separators
    --> src/main.rs:7:22
    |
    7 |     for number in 0..900000000 {
    |                      ^^^^^^^^^ help: consider: `900_000_000`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
    = note: `-W clippy::unreadable-literal` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::unreadable_literal)]`
    
    warning: `notright` (bin "notright") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s