chore: add lint to disallow prints to stdout (#2404)

This commit is contained in:
Álvaro Mondéjar 2024-03-08 19:18:37 +01:00 committed by GitHub
parent 2b4f5e0f58
commit 7928f61401
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View file

@ -8,4 +8,13 @@ args = ["fmt", "--", "--check", "--config-path", "${LEPTOS_PROJECT_DIRECTORY}"]
[tasks.clippy-each-feature]
dependencies = ["install-clippy"]
command = "cargo"
args = ["hack", "clippy", "--all", "--each-feature", "--no-dev-deps"]
args = [
"hack",
"clippy",
"--all",
"--each-feature",
"--no-dev-deps",
"--",
"-D",
"clippy::print_stdout"
]

View file

@ -44,6 +44,7 @@ macro_rules! debug_warn {
/// Log a string to the console (in the browser)
/// or via `println!()` (if not in the browser).
pub fn console_log(s: &str) {
#[allow(clippy::print_stdout)]
if is_server() {
println!("{s}");
} else {

View file

@ -270,6 +270,7 @@ where
if let Some(data) = static_data.get(path.path()) {
path.add_params(data);
}
#[allow(clippy::print_stdout)]
for path in path.into_paths() {
println!("building static route: {}", path);
path.write(options, app_fn.clone(), additional_context.clone())