Skip to content

Commit

Permalink
Fix unstable feature compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
slvrtrn committed Aug 25, 2024
1 parent 85f2b27 commit dda2d2b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ use crate::ProductInfo;
use hyper::header::USER_AGENT;
use hyper::http::request::Builder;
use std::collections::HashMap;

// See https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
const PKG_VER: &str = option_env!("CARGO_PKG_VERSION").unwrap_or("unknown");
const RUST_VER: &str = option_env!("CARGO_PKG_RUST_VERSION").unwrap_or("unknown");
const OS: &str = std::env::consts::OS;
use std::env::consts::OS;

fn get_user_agent(products_info: &[ProductInfo]) -> String {
let default_agent = format!("clickhouse-rs/{PKG_VER} (lv:rust/{RUST_VER}, os:{OS})");
// See https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
let pkg_ver = option_env!("CARGO_PKG_VERSION").unwrap_or("unknown");
let rust_ver = option_env!("CARGO_PKG_RUST_VERSION").unwrap_or("unknown");
let default_agent = format!("clickhouse-rs/{pkg_ver} (lv:rust/{rust_ver}, os:{OS})");
if products_info.is_empty() {
default_agent
} else {
Expand Down

0 comments on commit dda2d2b

Please sign in to comment.