Migrate all examples to use std::env::var_os (#312)

This commit is contained in:
Andrei Zolkin 2021-09-12 18:39:43 +03:00 committed by GitHub
parent 3741e16cf2
commit 9df57e6ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 21 additions and 21 deletions

View file

@ -24,7 +24,7 @@ use uuid::Uuid;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var(
"RUST_LOG",
"example_error_handling_and_dependency_injection=debug",

View file

@ -11,7 +11,7 @@ use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_form=debug")
}
tracing_subscriber::fmt::init();

View file

@ -15,7 +15,7 @@ use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_global_404_handler=debug")
}
tracing_subscriber::fmt::init();

View file

@ -56,7 +56,7 @@ static KEYS: Lazy<Keys> = Lazy::new(|| {
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_jwt=debug")
}
tracing_subscriber::fmt::init();

View file

@ -32,7 +32,7 @@ use tower_http::{
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_key_value_store=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();

View file

@ -18,7 +18,7 @@ use tokio_rustls::{
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_tls_rustls=debug")
}
tracing_subscriber::fmt::init();

View file

@ -15,7 +15,7 @@ use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_multipart_form=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();

View file

@ -35,7 +35,7 @@ static COOKIE_NAME: &str = "SESSION";
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_oauth=debug")
}
tracing_subscriber::fmt::init();

View file

@ -16,7 +16,7 @@ use tower::{filter::AsyncFilterLayer, util::AndThenLayer, BoxError};
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var(
"RUST_LOG",
"example_print_request_response=debug,tower_http=debug",

View file

@ -24,7 +24,7 @@ use uuid::Uuid;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_sessions=debug")
}
tracing_subscriber::fmt::init();

View file

@ -19,7 +19,7 @@ use tower_http::{services::ServeDir, trace::TraceLayer};
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_sse=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();

View file

@ -11,7 +11,7 @@ use tower_http::{services::ServeDir, trace::TraceLayer};
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var(
"RUST_LOG",
"example_static_file_server=debug,tower_http=debug",

View file

@ -18,7 +18,7 @@ use std::{convert::Infallible, net::SocketAddr};
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_templates=debug")
}
tracing_subscriber::fmt::init();

View file

@ -14,7 +14,7 @@ use tower_http::trace::TraceLayer;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_testing=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();

View file

@ -9,7 +9,7 @@ use axum::{handler::get, Router};
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_tls_rustls=debug")
}
tracing_subscriber::fmt::init();

View file

@ -35,7 +35,7 @@ use uuid::Uuid;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_todos=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();

View file

@ -19,7 +19,7 @@ use tokio_postgres::NoTls;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_tokio_postgres=debug")
}
tracing_subscriber::fmt::init();

View file

@ -18,7 +18,7 @@ use tracing::Span;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var(
"RUST_LOG",
"example_tracing_aka_logging=debug,tower_http=debug",

View file

@ -39,7 +39,7 @@ fn main() {
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "debug")
}
tracing_subscriber::fmt::init();

View file

@ -19,7 +19,7 @@ use std::net::SocketAddr;
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_versioning=debug")
}
tracing_subscriber::fmt::init();

View file

@ -25,7 +25,7 @@ use tower_http::{
#[tokio::main]
async fn main() {
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
if std::env::var_os("RUST_LOG").is_none() {
std::env::set_var("RUST_LOG", "example_websockets=debug,tower_http=debug")
}
tracing_subscriber::fmt::init();