Skip to content

Handle multiple spaces between fn and main - #161

Open
YetForge wants to merge 1 commit into
fornwall:mainfrom
YetForge:fix/main-whitespace-detection
Open

Handle multiple spaces between fn and main#161
YetForge wants to merge 1 commit into
fornwall:mainfrom
YetForge:fix/main-whitespace-detection

Conversation

@YetForge

Copy link
Copy Markdown

Addresses one case from #150

rust-script currently allows multiple spaces between main and (, but its
main-detection regex still requires exactly one space between fn and main.

As a result, valid Rust such as:

fn   main() {
    println!("Hello, World!");
}

is not detected as an existing main function and is wrapped incorrectly.

This change allows one or more spaces between fn and main while preserving
the existing detection behavior for the other supported main forms.

A regression test is added for the multi-space form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant