Why do i get red squiggles everytime on all my rust code in vscode when I start typing and it disappears only if i type fnmain() (picture included)

The "red squiggles" come from there being a main.rs file that does not have a main function in it.

By default, cargo new will create a binary (executable) package. This is indicated by there being main.rs in the src directory. This file must contain a main function, where execution begins. If you instead want to write a library used by other code, you can rename main.rs to lib.rs, or run cargo new --lib when creating your project.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.