about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNathan Whitaker <nathan.whitaker01@gmail.com>2020-10-26 19:19:06 -0400
committerNathan Whitaker <nathan.whitaker01@gmail.com>2020-10-26 19:19:06 -0400
commitcb8b9012dba9e467c052b3cc047e0c7babfcf724 (patch)
treeddd824e20032852a78f28e01837ca314dd819878
parent6ba127d3f06aa785eaf3df96f0adb505de67e74c (diff)
downloadrust-cb8b9012dba9e467c052b3cc047e0c7babfcf724.tar.gz
rust-cb8b9012dba9e467c052b3cc047e0c7babfcf724.zip
Address review comments
-rw-r--r--library/std/src/ffi/c_str.rs1
-rw-r--r--src/test/ui/lint/lint-temporary-cstring-as-param.rs4
-rw-r--r--src/test/ui/lint/lint-temporary-cstring-as-param.stderr4
-rw-r--r--src/test/ui/lint/lint-temporary-cstring-as-ptr.rs4
-rw-r--r--src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr4
5 files changed, 8 insertions, 9 deletions
diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs
index 1cfd73863a6..4a249d72bbc 100644
--- a/library/std/src/ffi/c_str.rs
+++ b/library/std/src/ffi/c_str.rs
@@ -109,7 +109,6 @@ use crate::sys;
 /// documentation of `CString` before use, as improper ownership management
 /// of `CString` instances can lead to invalid memory accesses, memory leaks,
 /// and other memory errors.
-
 #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone)]
 #[cfg_attr(not(test), rustc_diagnostic_item = "cstring_type")]
 #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/test/ui/lint/lint-temporary-cstring-as-param.rs b/src/test/ui/lint/lint-temporary-cstring-as-param.rs
index 197b7fd704f..2d40f6e871d 100644
--- a/src/test/ui/lint/lint-temporary-cstring-as-param.rs
+++ b/src/test/ui/lint/lint-temporary-cstring-as-param.rs
@@ -1,4 +1,3 @@
-// ignore-tidy-linelength
 #![deny(temporary_cstring_as_ptr)]
 
 use std::ffi::CString;
@@ -6,5 +5,6 @@ use std::ffi::CString;
 fn some_function(data: *const i8) {}
 
 fn main() {
-    some_function(CString::new("").unwrap().as_ptr()); //~ ERROR getting the inner pointer of a temporary `CString`
+    some_function(CString::new("").unwrap().as_ptr());
+    //~^ ERROR getting the inner pointer of a temporary `CString`
 }
diff --git a/src/test/ui/lint/lint-temporary-cstring-as-param.stderr b/src/test/ui/lint/lint-temporary-cstring-as-param.stderr
index b30ebd5e409..c72d56f2a5f 100644
--- a/src/test/ui/lint/lint-temporary-cstring-as-param.stderr
+++ b/src/test/ui/lint/lint-temporary-cstring-as-param.stderr
@@ -1,5 +1,5 @@
 error: getting the inner pointer of a temporary `CString`
-  --> $DIR/lint-temporary-cstring-as-param.rs:9:45
+  --> $DIR/lint-temporary-cstring-as-param.rs:8:45
    |
 LL |     some_function(CString::new("").unwrap().as_ptr());
    |                   ------------------------- ^^^^^^ this pointer will be invalid
@@ -7,7 +7,7 @@ LL |     some_function(CString::new("").unwrap().as_ptr());
    |                   this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
    |
 note: the lint level is defined here
-  --> $DIR/lint-temporary-cstring-as-param.rs:2:9
+  --> $DIR/lint-temporary-cstring-as-param.rs:1:9
    |
 LL | #![deny(temporary_cstring_as_ptr)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/lint/lint-temporary-cstring-as-ptr.rs b/src/test/ui/lint/lint-temporary-cstring-as-ptr.rs
index e463f84c48d..7aa4f2e1e00 100644
--- a/src/test/ui/lint/lint-temporary-cstring-as-ptr.rs
+++ b/src/test/ui/lint/lint-temporary-cstring-as-ptr.rs
@@ -1,9 +1,9 @@
-// ignore-tidy-linelength
 // this program is not technically incorrect, but is an obscure enough style to be worth linting
 #![deny(temporary_cstring_as_ptr)]
 
 use std::ffi::CString;
 
 fn main() {
-    let s = CString::new("some text").unwrap().as_ptr(); //~ ERROR getting the inner pointer of a temporary `CString`
+    let s = CString::new("some text").unwrap().as_ptr();
+    //~^ ERROR getting the inner pointer of a temporary `CString`
 }
diff --git a/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr b/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr
index 009cfe343a6..e69d2dd533a 100644
--- a/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr
+++ b/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr
@@ -1,5 +1,5 @@
 error: getting the inner pointer of a temporary `CString`
-  --> $DIR/lint-temporary-cstring-as-ptr.rs:8:48
+  --> $DIR/lint-temporary-cstring-as-ptr.rs:7:48
    |
 LL |     let s = CString::new("some text").unwrap().as_ptr();
    |             ---------------------------------- ^^^^^^ this pointer will be invalid
@@ -7,7 +7,7 @@ LL |     let s = CString::new("some text").unwrap().as_ptr();
    |             this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime
    |
 note: the lint level is defined here
-  --> $DIR/lint-temporary-cstring-as-ptr.rs:3:9
+  --> $DIR/lint-temporary-cstring-as-ptr.rs:2:9
    |
 LL | #![deny(temporary_cstring_as_ptr)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^