Skip to main content

validate_rust_snippet

Function validate_rust_snippet 

Source
pub fn validate_rust_snippet(
    code: &str,
    workspace_dir: Option<&Path>,
) -> Result<SnippetValidation>
Expand description

Validate a Rust code snippet using rustc.

This is used for the create command where the file does not yet exist in a Cargo project. It compiles the snippet as a standalone library crate to catch syntax and basic semantic errors.