Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ non_zero_suggestions = "warn"
nonstandard_macro_braces = "warn"
option_as_ref_cloned = "warn"
option_option = "warn"
panic = "deny"
path_buf_push_overwrite = "warn"
pathbuf_init_then_push = "warn"
precedence_bits = "warn"
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

msrv = "1.88"

allow-panic-in-tests = true
allow-unwrap-in-tests = true

# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
Expand Down
5 changes: 4 additions & 1 deletion crates/build/re_build_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ pub fn export_build_info_vars_for_crate(crate_name: &str) {
// work just fine otherwise.
Err(_err) if environment == Environment::UsedAsDependency => "<error>".to_owned(),

Err(err) => panic!("{err}"),
Err(err) => {
println!("cargo::error={err}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I didn't know about this!

return;
}
};

set_env("RE_BUILD_FEATURES", &features);
Expand Down
12 changes: 8 additions & 4 deletions crates/build/re_build_tools/src/rebuild_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ pub fn is_tracked_env_var_set(env_var_name: &str) -> bool {
"1" | "yes" | "true" => true,
"0" | "no" | "false" => false,
_ => {
panic!("Failed to understand boolean env-var {env_var_name}={value}");
println!(
"cargo::error=Failed to understand boolean env-var {env_var_name}={value}"
);
false
}
},
}
Expand Down Expand Up @@ -172,10 +175,11 @@ impl<'a> Packages<'a> {
/// dependencies are properly tracked whether they are remote, in-workspace,
/// or locally patched.
pub fn track_implicit_dep(&self, pkg_name: &str, files_to_watch: &mut HashSet<PathBuf>) {
let pkg = self.pkgs.get(pkg_name).unwrap_or_else(|| {
let Some(pkg) = self.pkgs.get(pkg_name) else {
let found_names: Vec<&str> = self.pkgs.values().map(|pkg| pkg.name.as_str()).collect();
panic!("Failed to find package {pkg_name:?} among {found_names:?}")
});
println!("cargo::error=Failed to find package {pkg_name:?} among {found_names:?}");
return;
};

// Track the root package itself
track_crate_files(&pkg.manifest_path, files_to_watch);
Expand Down
2 changes: 1 addition & 1 deletion crates/build/re_protos_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn generate_rust_code(
std::process::exit(1);
}
_ => {
panic!("{err}");
println!("cargo::error={err}");
}
}
}
Expand Down
24 changes: 0 additions & 24 deletions crates/store/re_types_core/src/arrow_zip_validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,27 +186,3 @@ where
V: ExactSizeIterator<Item = bool>,
{
}

impl<T, I, V> ZipValidity<T, I, V>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch of dead code!

where
I: Iterator<Item = T>,
V: Iterator<Item = bool>,
{
/// Unwrap into an iterator that has no null values.
pub fn unwrap_required(self) -> I {
if let Self::Required(i) = self {
i
} else {
panic!("Could not 'unwrap_required'. 'ZipValidity' iterator has nulls.");
}
}

/// Unwrap into an iterator that has null values.
pub fn unwrap_optional(self) -> ZipValidityIter<T, I, V> {
if let Self::Optional(i) = self {
i
} else {
panic!("Could not 'unwrap_optional'. 'ZipValidity' iterator has no nulls.");
}
}
}
1 change: 1 addition & 0 deletions crates/utils/re_log/src/result_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ where
#[track_caller]
fn unwrap_debug_or_log_error(self) -> Option<T> {
if cfg!(debug_assertions) {
#[expect(clippy::panic)]
match self {
Ok(value) => Some(value),
Err(err) => {
Expand Down
2 changes: 2 additions & 0 deletions crates/utils/re_log/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ impl log::Log for PanicOnWarn {
}
}

// Panic is expected only in this method as the logger requires it while the rest of the code must be panic-free.
#[expect(clippy::panic)]
fn log(&self, record: &log::Record<'_>) {
// `enabled` isn't called automatically by the `log!` macros, so we have to call it here.
// (it is only used by `log_enabled!`)
Expand Down
Loading