- fn test_remove_dbg_keep_expression() {
- check(r#"let res = $0dbg!(a + b).foo();"#, r#"let res = (a + b).foo();"#);
- check(r#"let res = $0dbg!(2 + 2) * 5"#, r#"let res = (2 + 2) * 5"#);
- check(r#"let res = $0dbg![2 + 2] * 5"#, r#"let res = (2 + 2) * 5"#);
- }
-
- #[test]
- fn test_remove_dbg_method_chaining() {
- check(r#"let res = $0dbg!(foo().bar()).baz();"#, r#"let res = foo().bar().baz();"#);
- check(r#"let res = $0dbg!(foo.bar()).baz();"#, r#"let res = foo.bar().baz();"#);
- }
-
- #[test]
- fn test_remove_dbg_field_chaining() {
- check(r#"let res = $0dbg!(foo.bar).baz;"#, r#"let res = foo.bar.baz;"#);
- }
-
- #[test]
- fn test_remove_dbg_from_inside_fn() {
- check_assist(
- remove_dbg,
- r#"
-fn square(x: u32) -> u32 {
- x * x
-}
-
-fn main() {
- let x = square(dbg$0!(5 + 10));
- println!("{}", x);
-}"#,
- r#"
-fn square(x: u32) -> u32 {
- x * x
-}
-
-fn main() {
- let x = square(5 + 10);
- println!("{}", x);
-}"#,
- );
+ fn test_remove_dbg_cast_cast() {
+ check(r#"let res = $0dbg!(x as u32) as u32;"#, r#"let res = x as u32 as u32;"#);