@@ -33,6 +33,7 @@ use core::{
3333 fmt:: { self , Display } ,
3434 hash,
3535} ;
36+ use std:: cmp:: Ordering ;
3637
3738#[ cfg( feature = "serde" ) ]
3839use serde:: { Deserialize , Serialize } ;
@@ -172,7 +173,7 @@ fn format_statement_list(f: &mut fmt::Formatter, statements: &[Statement]) -> fm
172173}
173174
174175/// An identifier, decomposed into its value or character data and the quote style.
175- #[ derive( Debug , Clone , PartialOrd , Ord ) ]
176+ #[ derive( Debug , Clone ) ]
176177#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
177178#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
178179pub struct Ident {
@@ -214,6 +215,34 @@ impl core::hash::Hash for Ident {
214215
215216impl Eq for Ident { }
216217
218+ impl PartialOrd for Ident {
219+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
220+ Some ( self . cmp ( other) )
221+ }
222+ }
223+
224+ impl Ord for Ident {
225+ fn cmp ( & self , other : & Self ) -> Ordering {
226+ let Ident {
227+ value,
228+ quote_style,
229+ // exhaustiveness check; we ignore spans in ordering
230+ span : _,
231+ } = self ;
232+
233+ let Ident {
234+ value : other_value,
235+ quote_style : other_quote_style,
236+ // exhaustiveness check; we ignore spans in ordering
237+ span : _,
238+ } = other;
239+
240+ // First compare by value, then by quote_style
241+ value. cmp ( other_value)
242+ . then_with ( || quote_style. cmp ( other_quote_style) )
243+ }
244+ }
245+
217246impl Ident {
218247 /// Create a new identifier with the given value and no quotes and an empty span.
219248 pub fn new < S > ( value : S ) -> Self
@@ -4173,7 +4202,7 @@ pub enum Statement {
41734202 /// ```sql
41744203 /// NOTIFY channel [ , payload ]
41754204 /// ```
4176- /// send a notification event together with an optional “ payload” string to channel
4205+ /// send a notification event together with an optional " payload" string to channel
41774206 ///
41784207 /// See Postgres <https://www.postgresql.org/docs/current/sql-notify.html>
41794208 NOTIFY {
0 commit comments