3 #![allow(unused_variables)]
5 fn option_unwrap_or() {
61 // cases where the none arm isn't a constant expression
62 // are not linted due to potential ownership issues
64 // ownership issue example, don't lint
66 let mut option: Option<NonCopyable> = None;
70 option = Some(NonCopyable);
76 // ownership issue example, don't lint
77 let option: Option<&str> = None;
80 None => &format!("{} {}!", "hello", "world"),
84 fn result_unwrap_or() {
86 match Ok::<i32, &str>(1) {
91 // int case, suggestion must surround with parenthesis
92 match Ok(1) as Result<i32, &str> {
98 match Ok::<i32, &str>(1) {
104 match Ok::<i32, &str>(1) {
111 match Ok::<i32, &str>(1) {
121 match Ok::<&str, &str>("Bob") {
127 match Ok::<i32, &str>(1) {
131 match Ok::<i32, &str>(1) {
136 match Ok::<i32, &str>(j) {
140 match Ok::<i32, &str>(j) {
146 // don't lint, Err value is used
147 match Ok::<&str, &str>("Alice") {
151 // could lint, but unused_variables takes care of it
152 match Ok::<&str, &str>("Alice") {