clippy & deny fixes

This commit is contained in:
Luke Street 2025-02-07 00:15:21 -07:00
parent e8de35b78e
commit 561a9107e2
9 changed files with 17 additions and 28 deletions

8
Cargo.lock generated
View File

@ -3114,9 +3114,9 @@ dependencies = [
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.68" version = "0.10.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6"
dependencies = [ dependencies = [
"bitflags 2.8.0", "bitflags 2.8.0",
"cfg-if", "cfg-if",
@ -3146,9 +3146,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.104" version = "0.9.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",

View File

@ -239,7 +239,7 @@ allow-git = []
[sources.allow-org] [sources.allow-org]
# github.com organizations to allow git sources for # github.com organizations to allow git sources for
github = [] github = ["encounter"]
# gitlab.com organizations to allow git sources for # gitlab.com organizations to allow git sources for
gitlab = [] gitlab = []
# bitbucket.org organizations to allow git sources for # bitbucket.org organizations to allow git sources for

View File

@ -315,19 +315,15 @@ impl ObjectConfig {
(target_obj_dir, &object.path, &object.target_path) (target_obj_dir, &object.path, &object.target_path)
{ {
Some(target_obj_dir.join(path.with_platform_encoding())) Some(target_obj_dir.join(path.with_platform_encoding()))
} else if let Some(path) = &object.target_path {
Some(project_dir.join(path.with_platform_encoding()))
} else { } else {
None object.target_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
}; };
let base_path = if let (Some(base_obj_dir), Some(path), None) = let base_path = if let (Some(base_obj_dir), Some(path), None) =
(base_obj_dir, &object.path, &object.base_path) (base_obj_dir, &object.path, &object.base_path)
{ {
Some(base_obj_dir.join(path.with_platform_encoding())) Some(base_obj_dir.join(path.with_platform_encoding()))
} else if let Some(path) = &object.base_path {
Some(project_dir.join(path.with_platform_encoding()))
} else { } else {
None object.base_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
}; };
Self { Self {
name: object.name().to_string(), name: object.name().to_string(),

View File

@ -386,7 +386,7 @@ fn line_info(obj_file: &File<'_>, sections: &mut [ObjSection], obj_data: &[u8])
.index() .index()
.0; .0;
let mut section_data = &reader[..]; let mut section_data = reader;
let size = read_u32(obj_file, &mut section_data)? as usize; let size = read_u32(obj_file, &mut section_data)? as usize;
if size > reader.len() { if size > reader.len() {
bail!("Line info size {size} exceeds remaining size {}", reader.len()); bail!("Line info size {size} exceeds remaining size {}", reader.len());

View File

@ -39,13 +39,13 @@ impl SplitMeta {
} }
match note.n_type { match note.n_type {
NT_SPLIT_GENERATOR => { NT_SPLIT_GENERATOR => {
let string = String::from_utf8(note.desc.to_vec()) let string =
.map_err(|e| anyhow::Error::from(e))?; String::from_utf8(note.desc.to_vec()).map_err(anyhow::Error::new)?;
result.generator = Some(string); result.generator = Some(string);
} }
NT_SPLIT_MODULE_NAME => { NT_SPLIT_MODULE_NAME => {
let string = String::from_utf8(note.desc.to_vec()) let string =
.map_err(|e| anyhow::Error::from(e))?; String::from_utf8(note.desc.to_vec()).map_err(anyhow::Error::new)?;
result.module_name = Some(string); result.module_name = Some(string);
} }
NT_SPLIT_MODULE_ID => { NT_SPLIT_MODULE_ID => {

View File

@ -119,19 +119,15 @@ impl ObjectConfig {
(target_obj_dir, &object.path, &object.target_path) (target_obj_dir, &object.path, &object.target_path)
{ {
Some(target_obj_dir.join(path.with_platform_encoding())) Some(target_obj_dir.join(path.with_platform_encoding()))
} else if let Some(path) = &object.target_path {
Some(project_dir.join(path.with_platform_encoding()))
} else { } else {
None object.target_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
}; };
let base_path = if let (Some(base_obj_dir), Some(path), None) = let base_path = if let (Some(base_obj_dir), Some(path), None) =
(base_obj_dir, &object.path, &object.base_path) (base_obj_dir, &object.path, &object.base_path)
{ {
Some(base_obj_dir.join(path.with_platform_encoding())) Some(base_obj_dir.join(path.with_platform_encoding()))
} else if let Some(path) = &object.base_path {
Some(project_dir.join(path.with_platform_encoding()))
} else { } else {
None object.base_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
}; };
let source_path = let source_path =
object.source_path().map(|s| project_dir.join(s.with_platform_encoding())); object.source_path().map(|s| project_dir.join(s.with_platform_encoding()));

View File

@ -384,7 +384,7 @@ fn object_context_ui(ui: &mut egui::Ui, object: &ObjectConfig) {
.clicked() .clicked()
{ {
log::info!("Opening file {}", source_path); log::info!("Opening file {}", source_path);
if let Err(e) = open::that_detached(&source_path) { if let Err(e) = open::that_detached(source_path) {
log::error!("Failed to open source file: {e}"); log::error!("Failed to open source file: {e}");
} }
ui.close_menu(); ui.close_menu();

View File

@ -150,7 +150,7 @@ pub fn diff_view_ui(
navigation.view = View::SymbolDiff; navigation.view = View::SymbolDiff;
} }
// Execute navigation if it changed // Execute navigation if it changed
if navigation != current_navigation && !state.post_build_nav.is_some() { if navigation != current_navigation && state.post_build_nav.is_none() {
ret = Some(DiffViewAction::Navigate(navigation)); ret = Some(DiffViewAction::Navigate(navigation));
} }

View File

@ -262,11 +262,8 @@ impl DiffViewState {
DiffViewAction::SetSearch(search) => { DiffViewAction::SetSearch(search) => {
self.search_regex = if search.is_empty() { self.search_regex = if search.is_empty() {
None None
} else if let Ok(regex) = RegexBuilder::new(&search).case_insensitive(true).build()
{
Some(regex)
} else { } else {
None RegexBuilder::new(&search).case_insensitive(true).build().ok()
}; };
self.search = search; self.search = search;
} }