We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ae2c2f commit 0a4988aCopy full SHA for 0a4988a
c2rust-refactor/src/util/mod.rs
@@ -2,6 +2,7 @@
2
use rustc_ast::*;
3
use rustc_span::Symbol;
4
use smallvec::SmallVec;
5
+use std::fmt::Debug;
6
7
pub mod cursor;
8
pub mod dataflow;
@@ -17,16 +18,16 @@ impl<T> Lone<T> for T {
17
18
}
19
20
-impl<T> Lone<T> for Vec<T> {
21
+impl<T: Debug> Lone<T> for Vec<T> {
22
fn lone(mut self) -> T {
- assert!(self.len() == 1);
23
+ assert!(self.len() == 1, "Vec has multiple elements: {self:#?}");
24
self.pop().unwrap()
25
26
27
-impl<T> Lone<T> for SmallVec<[T; 1]> {
28
+impl<T: Debug> Lone<T> for SmallVec<[T; 1]> {
29
30
+ assert!(self.len() == 1, "SmallVec has multiple elements: {self:#?}");
31
32
33
0 commit comments