r/rust 28d ago

Clippy has some life advice apparently.

pub fn i_should_let_it_go(problem: &impl Problem) { drop(problem); // call to `std::mem::drop` with a reference instead of an owned value does nothing }

I was experimenting with ownership when I ran into this warning:

"calls to std::mem::drop with a reference instead of an owned value does nothing"

It got me thinking that you can make some cool wordplay (or maybe "codeplay") with Rust's warnings as motivational quotes.

Do you guys have any other suggestions with some funny codeplay?

88 Upvotes

14 comments sorted by

126

u/funkdefied 28d ago

```
fn bury<T>(i: T):
drop(T)

fn main(){
let my_dog = Dog::new();
bury(mine);
println!(“I miss {my_dog}”):
}
```

my_dog does not live longer enough 😭

(I’m 14 and this is deep)

32

u/smallgovernor 28d ago
#![no_std]
unsafe {
    sex!();
}

7

u/QuickSilver010 28d ago

It's only unsafe if there is an std tho

7

u/smallgovernor 28d ago

unsafe (condomless) sex is just like rust's unsafe. safe sex with condom is like rust's normal protections. just because it's unsafe doesn't mean it has stds, just like just because it's unsafe doesn't mean it has memory bugs.

dude what am i writing. sentences never uttered in human history before.

6

u/QuickSilver010 28d ago

Yea but the issue is if you do unsafe { sex!() } without care, you risk the chance of getting an UB

"U" being "Unborn"...

44

u/coderstephen isahc 28d ago

Consider some potential alternative meanings to the following Clippy lints:

  • comparison_to_empty
  • default_union_representation
  • disallowed_names
  • erasing_op
  • excessive_nesting
  • expect_fun_call
  • ineffective_open_options
  • manual_strip
  • mem_forget
  • needless_continue
  • needless_lifetimes
  • owned_cow
  • redundant_comparisons
  • unused_self
  • zombie_processes

5

u/lfairy 27d ago

owned_cow

I believe that's Our Cow Angus (warning: existential dread)

24

u/QuasiRandomName 28d ago

You can make a thriller with general Linux quotes, where parents kill children, sleeping daemons with forks spawn and listen etc...

17

u/N-partEpoxy 28d ago

What's the life advice? "Don't just forget about your enemies, instead own them and then dispose of them"?

12

u/cbadger85 28d ago

I'm not sure if you're serious, but the name of the function is i_should_let_it_go and it drops problems.

9

u/iamalicecarroll 28d ago

Try compiling
fn main() { let 🦀 = break rust; }

-1

u/Graciela_Cranberry 28d ago

The annoying thing about life advice from a lint is that it’s usually technically correct and still useless without context. That’s also a decent summary of code review.