mirror of https://codeberg.org/topola/topola.git
vendored/contracts: fix overly verbose type annotations for enum results
This fixes issue #15.
This commit is contained in:
parent
f414089521
commit
c42eab0126
|
|
@ -253,7 +253,7 @@ impl<M: AccessMesadata> Invoker<M> {
|
|||
|
||||
#[debug_requires(self.ongoing_command.is_none())]
|
||||
fn dispatch_command(&mut self, command: &Command) -> Result<Execute, InvokerError> {
|
||||
match command {
|
||||
Ok(match command {
|
||||
Command::Autoroute(selection, options) => {
|
||||
let mut ratlines = self.autorouter.selected_ratlines(selection);
|
||||
|
||||
|
|
@ -271,23 +271,23 @@ impl<M: AccessMesadata> Invoker<M> {
|
|||
});
|
||||
}
|
||||
|
||||
Ok::<Execute, InvokerError>(Execute::Autoroute(
|
||||
Execute::Autoroute(
|
||||
self.autorouter.autoroute_ratlines(ratlines, *options)?,
|
||||
))
|
||||
)
|
||||
}
|
||||
Command::PlaceVia(weight) => {
|
||||
Ok::<Execute, InvokerError>(Execute::PlaceVia(self.autorouter.place_via(*weight)?))
|
||||
}
|
||||
Command::RemoveBands(selection) => Ok::<Execute, InvokerError>(Execute::RemoveBands(
|
||||
Command::PlaceVia(weight) => Execute::PlaceVia(
|
||||
self.autorouter.place_via(*weight)?
|
||||
),
|
||||
Command::RemoveBands(selection) => Execute::RemoveBands(
|
||||
self.autorouter.remove_bands(selection)?,
|
||||
)),
|
||||
Command::CompareDetours(selection, options) => Ok::<Execute, InvokerError>(
|
||||
Execute::CompareDetours(self.autorouter.compare_detours(selection, *options)?),
|
||||
),
|
||||
Command::MeasureLength(selection) => Ok::<Execute, InvokerError>(
|
||||
Execute::MeasureLength(self.autorouter.measure_length(selection)?),
|
||||
Command::CompareDetours(selection, options) => Execute::CompareDetours(
|
||||
self.autorouter.compare_detours(selection, *options)?,
|
||||
),
|
||||
}
|
||||
Command::MeasureLength(selection) => Execute::MeasureLength(
|
||||
self.autorouter.measure_length(selection)?,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
#[debug_requires(self.ongoing_command.is_none())]
|
||||
|
|
@ -308,7 +308,7 @@ impl<M: AccessMesadata> Invoker<M> {
|
|||
Command::MeasureLength(..) => {}
|
||||
}
|
||||
|
||||
Ok::<(), InvokerError>(self.history.undo()?)
|
||||
Ok(self.history.undo()?)
|
||||
}
|
||||
|
||||
//#[debug_requires(self.ongoing.is_none())]
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
|||
return Err(collision.into());
|
||||
}
|
||||
|
||||
Ok::<Cane, DrawingException>(cane)
|
||||
Ok(cane)
|
||||
}
|
||||
|
||||
#[debug_ensures(self.geometry_with_rtree.graph().node_count() == old(self.geometry_with_rtree.graph().node_count()))]
|
||||
|
|
@ -538,7 +538,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
|||
maybe_rail = self.primitive(rail).outer();
|
||||
}
|
||||
|
||||
Ok::<(), DrawingException>(())
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[debug_ensures(ret.is_ok() -> self.geometry_with_rtree.graph().node_count() == old(self.geometry_with_rtree.graph().node_count() + 4))]
|
||||
|
|
@ -606,7 +606,7 @@ impl<CW: Copy, R: AccessRules> Drawing<CW, R> {
|
|||
err
|
||||
})?;
|
||||
|
||||
Ok::<Cane, DrawingException>(Cane {
|
||||
Ok(Cane {
|
||||
seg,
|
||||
dot: seg_to,
|
||||
bend,
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ impl<'a, R: AccessRules> Draw<'a, R> {
|
|||
let layer = head.face().primitive(self.layout.drawing()).layer();
|
||||
let maybe_net = head.face().primitive(self.layout.drawing()).maybe_net();
|
||||
|
||||
Ok::<BandTermsegIndex, DrawException>(match head.face() {
|
||||
Ok(match head.face() {
|
||||
DotIndex::Fixed(dot) => BandTermsegIndex::Straight(
|
||||
self.layout
|
||||
.add_lone_loose_seg(
|
||||
|
|
@ -210,7 +210,7 @@ impl<'a, R: AccessRules> Draw<'a, R> {
|
|||
},
|
||||
cw,
|
||||
)?;
|
||||
Ok::<CaneHead, DrawingException>(CaneHead {
|
||||
Ok(CaneHead {
|
||||
face: self
|
||||
.layout
|
||||
.drawing()
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ impl<'a, R: AccessRules> Tracer<'a, R> {
|
|||
|
||||
let length = trace.path.len();
|
||||
self.undo_path(trace, length - prefix_length);
|
||||
Ok::<(), TracerException>(self.path(navmesh, trace, &path[prefix_length..], width)?)
|
||||
self.path(navmesh, trace, &path[prefix_length..], width)
|
||||
}
|
||||
|
||||
#[debug_ensures(ret.is_ok() -> trace.path.len() == old(trace.path.len() + path.len()))]
|
||||
|
|
|
|||
|
|
@ -345,7 +345,10 @@ pub(crate) fn generate(
|
|||
syn::visit::visit_block(&mut try_detector, &mut block);
|
||||
|
||||
if try_detector.found_try {
|
||||
break 'blk quote::quote! { let ret: #return_type = 'run: { try { #block? } }; };
|
||||
break 'blk quote::quote! { let ret: #return_type = 'run: { try {
|
||||
let ret2: #return_type = #block;
|
||||
ret2?
|
||||
} }; };
|
||||
} else {
|
||||
break 'blk quote::quote! { let ret: #return_type = 'run: #block; };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue