Skip to content

Commit

Permalink
fix dead code warning in ComPtr, update natvis
Browse files Browse the repository at this point in the history
  • Loading branch information
Arlie Davis committed Jun 26, 2024
1 parent 526f7bc commit cf10792
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
13 changes: 9 additions & 4 deletions crates/libs/result/.natvis
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="windows_result::error::Error">
<DisplayString>{(HRESULT)code.__0.__0}</DisplayString>
<Expand>
<ExpandedItem>code</ExpandedItem>
<Item Name="[detail]">detail</Item>
<Item Name="[code]">(HRESULT)code.__0.__0</Item>
<Item Name="[info]">info</Item>
</Expand>
</Type>

<Type Name="windows_result::hresult::HRESULT">
<DisplayString>{(::HRESULT)__0}</DisplayString>
<DisplayString>{(HRESULT)__0}</DisplayString>
</Type>

<Type Name="windows_result::hresult::NonZeroHRESULT">
<DisplayString>{(::HRESULT)__0.__0.__0}</DisplayString>
<Type Name="windows_result::error::error_info::ErrorInfo">
<DisplayString>ErrorInfo</DisplayString>
<Expand>
<Item Name="[object]">*(void**)&amp;ptr</Item>
</Expand>
</Type>
</AutoVisualizer>
8 changes: 6 additions & 2 deletions crates/libs/result/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,14 @@ mod error_info {
mod error_info {
use super::*;

// We use this name so that the NatVis <Type> element for ErrorInfo does *not* match this type.
// This prevents the NatVis description from failing to load.
#[derive(Clone, Default)]
pub(crate) struct ErrorInfo;
pub(crate) struct EmptyErrorInfo;

impl ErrorInfo {
pub(crate) use EmptyErrorInfo as ErrorInfo;

impl EmptyErrorInfo {
pub(crate) const fn empty() -> Self {
Self
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/result/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use alloc::{string::String, vec::Vec};
mod bindings;
use bindings::*;

#[cfg(windows)]
#[cfg(all(windows, feature = "error-info", not(feature = "disable-error-info")))]
mod com;

#[cfg(windows)]
Expand Down

0 comments on commit cf10792

Please sign in to comment.