Skip to content

Commit 5a5b3eb

Browse files
committed
clippy & deny fixes
1 parent ef9d0cc commit 5a5b3eb

File tree

9 files changed

+17
-28
lines changed

9 files changed

+17
-28
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deny.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ allow-git = []
239239

240240
[sources.allow-org]
241241
# github.com organizations to allow git sources for
242-
github = []
242+
github = ["encounter"]
243243
# gitlab.com organizations to allow git sources for
244244
gitlab = []
245245
# bitbucket.org organizations to allow git sources for

objdiff-cli/src/cmd/diff.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,19 +315,15 @@ impl ObjectConfig {
315315
(target_obj_dir, &object.path, &object.target_path)
316316
{
317317
Some(target_obj_dir.join(path.with_platform_encoding()))
318-
} else if let Some(path) = &object.target_path {
319-
Some(project_dir.join(path.with_platform_encoding()))
320318
} else {
321-
None
319+
object.target_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
322320
};
323321
let base_path = if let (Some(base_obj_dir), Some(path), None) =
324322
(base_obj_dir, &object.path, &object.base_path)
325323
{
326324
Some(base_obj_dir.join(path.with_platform_encoding()))
327-
} else if let Some(path) = &object.base_path {
328-
Some(project_dir.join(path.with_platform_encoding()))
329325
} else {
330-
None
326+
object.base_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
331327
};
332328
Self {
333329
name: object.name().to_string(),

objdiff-core/src/obj/read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ fn line_info(obj_file: &File<'_>, sections: &mut [ObjSection], obj_data: &[u8])
386386
.index()
387387
.0;
388388

389-
let mut section_data = &reader[..];
389+
let mut section_data = reader;
390390
let size = read_u32(obj_file, &mut section_data)? as usize;
391391
if size > reader.len() {
392392
bail!("Line info size {size} exceeds remaining size {}", reader.len());

objdiff-core/src/obj/split_meta.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ impl SplitMeta {
3939
}
4040
match note.n_type {
4141
NT_SPLIT_GENERATOR => {
42-
let string = String::from_utf8(note.desc.to_vec())
43-
.map_err(|e| anyhow::Error::from(e))?;
42+
let string =
43+
String::from_utf8(note.desc.to_vec()).map_err(anyhow::Error::new)?;
4444
result.generator = Some(string);
4545
}
4646
NT_SPLIT_MODULE_NAME => {
47-
let string = String::from_utf8(note.desc.to_vec())
48-
.map_err(|e| anyhow::Error::from(e))?;
47+
let string =
48+
String::from_utf8(note.desc.to_vec()).map_err(anyhow::Error::new)?;
4949
result.module_name = Some(string);
5050
}
5151
NT_SPLIT_MODULE_ID => {

objdiff-gui/src/app.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,15 @@ impl ObjectConfig {
119119
(target_obj_dir, &object.path, &object.target_path)
120120
{
121121
Some(target_obj_dir.join(path.with_platform_encoding()))
122-
} else if let Some(path) = &object.target_path {
123-
Some(project_dir.join(path.with_platform_encoding()))
124122
} else {
125-
None
123+
object.target_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
126124
};
127125
let base_path = if let (Some(base_obj_dir), Some(path), None) =
128126
(base_obj_dir, &object.path, &object.base_path)
129127
{
130128
Some(base_obj_dir.join(path.with_platform_encoding()))
131-
} else if let Some(path) = &object.base_path {
132-
Some(project_dir.join(path.with_platform_encoding()))
133129
} else {
134-
None
130+
object.base_path.as_ref().map(|path| project_dir.join(path.with_platform_encoding()))
135131
};
136132
let source_path =
137133
object.source_path().map(|s| project_dir.join(s.with_platform_encoding()));

objdiff-gui/src/views/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn object_context_ui(ui: &mut egui::Ui, object: &ObjectConfig) {
384384
.clicked()
385385
{
386386
log::info!("Opening file {}", source_path);
387-
if let Err(e) = open::that_detached(&source_path) {
387+
if let Err(e) = open::that_detached(source_path) {
388388
log::error!("Failed to open source file: {e}");
389389
}
390390
ui.close_menu();

objdiff-gui/src/views/diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn diff_view_ui(
150150
navigation.view = View::SymbolDiff;
151151
}
152152
// Execute navigation if it changed
153-
if navigation != current_navigation && !state.post_build_nav.is_some() {
153+
if navigation != current_navigation && state.post_build_nav.is_none() {
154154
ret = Some(DiffViewAction::Navigate(navigation));
155155
}
156156

objdiff-gui/src/views/symbol_diff.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,8 @@ impl DiffViewState {
262262
DiffViewAction::SetSearch(search) => {
263263
self.search_regex = if search.is_empty() {
264264
None
265-
} else if let Ok(regex) = RegexBuilder::new(&search).case_insensitive(true).build()
266-
{
267-
Some(regex)
268265
} else {
269-
None
266+
RegexBuilder::new(&search).case_insensitive(true).build().ok()
270267
};
271268
self.search = search;
272269
}

0 commit comments

Comments
 (0)