@@ -224,7 +224,7 @@ impl DbError {
224224 ///
225225 /// Might run to multiple lines.
226226 pub fn detail ( & self ) -> Option < & str > {
227- self . detail . as_ref ( ) . map ( |s| & * * s )
227+ self . detail . as_deref ( )
228228 }
229229
230230 /// An optional suggestion what to do about the problem.
@@ -233,7 +233,7 @@ impl DbError {
233233 /// (potentially inappropriate) rather than hard facts. Might run to
234234 /// multiple lines.
235235 pub fn hint ( & self ) -> Option < & str > {
236- self . hint . as_ref ( ) . map ( |s| & * * s )
236+ self . hint . as_deref ( )
237237 }
238238
239239 /// An optional error cursor position into either the original query string
@@ -248,20 +248,20 @@ impl DbError {
248248 /// language functions and internally-generated queries. The trace is one
249249 /// entry per line, most recent first.
250250 pub fn where_ ( & self ) -> Option < & str > {
251- self . where_ . as_ref ( ) . map ( |s| & * * s )
251+ self . where_ . as_deref ( )
252252 }
253253
254254 /// If the error was associated with a specific database object, the name
255255 /// of the schema containing that object, if any. (PostgreSQL 9.3+)
256256 pub fn schema ( & self ) -> Option < & str > {
257- self . schema . as_ref ( ) . map ( |s| & * * s )
257+ self . schema . as_deref ( )
258258 }
259259
260260 /// If the error was associated with a specific table, the name of the
261261 /// table. (Refer to the schema name field for the name of the table's
262262 /// schema.) (PostgreSQL 9.3+)
263263 pub fn table ( & self ) -> Option < & str > {
264- self . table . as_ref ( ) . map ( |s| & * * s )
264+ self . table . as_deref ( )
265265 }
266266
267267 /// If the error was associated with a specific table column, the name of
@@ -270,14 +270,14 @@ impl DbError {
270270 /// (Refer to the schema and table name fields to identify the table.)
271271 /// (PostgreSQL 9.3+)
272272 pub fn column ( & self ) -> Option < & str > {
273- self . column . as_ref ( ) . map ( |s| & * * s )
273+ self . column . as_deref ( )
274274 }
275275
276276 /// If the error was associated with a specific data type, the name of the
277277 /// data type. (Refer to the schema name field for the name of the data
278278 /// type's schema.) (PostgreSQL 9.3+)
279279 pub fn datatype ( & self ) -> Option < & str > {
280- self . datatype . as_ref ( ) . map ( |s| & * * s )
280+ self . datatype . as_deref ( )
281281 }
282282
283283 /// If the error was associated with a specific constraint, the name of the
@@ -287,12 +287,12 @@ impl DbError {
287287 /// (For this purpose, indexes are treated as constraints, even if they
288288 /// weren't created with constraint syntax.) (PostgreSQL 9.3+)
289289 pub fn constraint ( & self ) -> Option < & str > {
290- self . constraint . as_ref ( ) . map ( |s| & * * s )
290+ self . constraint . as_deref ( )
291291 }
292292
293293 /// The file name of the source-code location where the error was reported.
294294 pub fn file ( & self ) -> Option < & str > {
295- self . file . as_ref ( ) . map ( |s| & * * s )
295+ self . file . as_deref ( )
296296 }
297297
298298 /// The line number of the source-code location where the error was
@@ -303,7 +303,7 @@ impl DbError {
303303
304304 /// The name of the source-code routine reporting the error.
305305 pub fn routine ( & self ) -> Option < & str > {
306- self . routine . as_ref ( ) . map ( |s| & * * s )
306+ self . routine . as_deref ( )
307307 }
308308}
309309
0 commit comments