Skip to content

Commit

Permalink
Avoid warnings for rosidl_runtime_rs
Browse files Browse the repository at this point in the history
  • Loading branch information
esteve committed Nov 15, 2023
1 parent bc44060 commit bab92ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
6 changes: 5 additions & 1 deletion rosidl_runtime_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,9 @@ quickcheck = "1"
# Needed for testing serde support
serde_json = "1"

[build-dependencies]
# Needed for uploading documentation to docs.rs
cfg-if = "1.0.0"

[package.metadata.docs.rs]
features = ["generate_docs"]
features = ["generate_docs"]
26 changes: 15 additions & 11 deletions rosidl_runtime_rs/build.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
use std::env;
use std::path::Path;
cfg_if::cfg_if! {
if #[cfg(not(feature="generate_docs"))] {
use std::env;
use std::path::Path;

const AMENT_PREFIX_PATH: &str = "AMENT_PREFIX_PATH";
const AMENT_PREFIX_PATH: &str = "AMENT_PREFIX_PATH";

fn get_env_var_or_abort(env_var: &'static str) -> String {
if let Ok(value) = env::var(env_var) {
value
} else {
panic!(
"{} environment variable not set - please source ROS 2 installation first.",
env_var
);
fn get_env_var_or_abort(env_var: &'static str) -> String {
if let Ok(value) = env::var(env_var) {
value
} else {
panic!(
"{} environment variable not set - please source ROS 2 installation first.",
env_var
);
}
}
}
}

Expand Down

0 comments on commit bab92ae

Please sign in to comment.