1 error: you are getting the inner pointer of a temporary `CString`
2 --> $DIR/cstring.rs:8:5
4 LL | CString::new("foo").unwrap().as_ptr();
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 note: lint level defined here
8 --> $DIR/cstring.rs:1:9
10 LL | #![deny(clippy::temporary_cstring_as_ptr)]
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 = note: that pointer will be invalid outside this expression
13 help: assign the `CString` to a variable to extend its lifetime
14 --> $DIR/cstring.rs:8:5
16 LL | CString::new("foo").unwrap().as_ptr();
17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 error: you are getting the inner pointer of a temporary `CString`
20 --> $DIR/cstring.rs:9:5
22 LL | CString::new("foo").expect("dummy").as_ptr();
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 = note: that pointer will be invalid outside this expression
26 help: assign the `CString` to a variable to extend its lifetime
27 --> $DIR/cstring.rs:9:5
29 LL | CString::new("foo").expect("dummy").as_ptr();
30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32 error: you are getting the inner pointer of a temporary `CString`
33 --> $DIR/cstring.rs:22:22
35 LL | unsafe { foo(cstr.unwrap().as_ptr()) }
36 | ^^^^^^^^^^^^^^^^^^^^^^
38 = note: that pointer will be invalid outside this expression
39 help: assign the `CString` to a variable to extend its lifetime
40 --> $DIR/cstring.rs:22:22
42 LL | unsafe { foo(cstr.unwrap().as_ptr()) }
45 error: aborting due to 3 previous errors