diff --git a/src/imports.rs b/src/imports.rs index b741dd9b5da..52b6e057a83 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -943,10 +943,10 @@ impl Ord for UseSegment { version_sort(ia, ib) } else { // snake_case < CamelCase < UPPER_SNAKE_CASE - if ia.starts_with(char::is_uppercase) && ib.starts_with(char::is_lowercase) { + if ia.starts_with(char::is_uppercase) && !ib.starts_with(char::is_uppercase) { return Ordering::Greater; } - if ia.starts_with(char::is_lowercase) && ib.starts_with(char::is_uppercase) { + if !ia.starts_with(char::is_uppercase) && ib.starts_with(char::is_uppercase) { return Ordering::Less; } if is_upper_snake_case(ia) && !is_upper_snake_case(ib) { diff --git a/tests/source/issue-6333.rs b/tests/source/issue-6333.rs new file mode 100644 index 00000000000..074610f8252 --- /dev/null +++ b/tests/source/issue-6333.rs @@ -0,0 +1,24 @@ +// rustfmt-edition: 2021 +// rustfmt-max_width: 125 +pub use ::dafny_runtime::Sequence; +pub use ::std::rc::Rc; +pub use crate::r#_StructuredEncryptionUtil_Compile::CanonCryptoItem; +pub use ::dafny_runtime::itertools::Itertools; +pub use crate::software::amazon::cryptography::dbencryptionsdk::structuredencryption::internaldafny::types::CryptoAction; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptedDataKey; +pub use ::dafny_runtime::Object; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::IAwsCryptographicPrimitivesClient; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::AlgorithmSuiteInfo; +pub use ::dafny_runtime::DafnyCharUTF16; +pub use crate::r#_StructuredEncryptionUtil_Compile::MessageID; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptionMaterials; +pub use crate::r#_Wrappers_Compile::Outcome; +pub use ::dafny_runtime::string_utf16_of; +pub use ::dafny_runtime::int; +pub use ::dafny_runtime::MapBuilder; +pub use ::dafny_runtime::_System::nat; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::HMacInput; +pub use ::dafny_runtime::rd; +pub use ::dafny_runtime::truncate; +pub use ::dafny_runtime::DafnyTypeEq; +pub use ::dafny_runtime::DafnyType; diff --git a/tests/target/issue-6333-2024.rs b/tests/target/issue-6333-2024.rs new file mode 100644 index 00000000000..c64d4dff8a8 --- /dev/null +++ b/tests/target/issue-6333-2024.rs @@ -0,0 +1,24 @@ +// rustfmt-edition: 2024 +// rustfmt-max_width: 125 +pub use crate::r#_StructuredEncryptionUtil_Compile::CanonCryptoItem; +pub use crate::r#_StructuredEncryptionUtil_Compile::MessageID; +pub use crate::r#_Wrappers_Compile::Outcome; +pub use crate::software::amazon::cryptography::dbencryptionsdk::structuredencryption::internaldafny::types::CryptoAction; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::AlgorithmSuiteInfo; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptedDataKey; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptionMaterials; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::HMacInput; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::IAwsCryptographicPrimitivesClient; +pub use ::dafny_runtime::_System::nat; +pub use ::dafny_runtime::DafnyCharUTF16; +pub use ::dafny_runtime::DafnyType; +pub use ::dafny_runtime::DafnyTypeEq; +pub use ::dafny_runtime::MapBuilder; +pub use ::dafny_runtime::Object; +pub use ::dafny_runtime::Sequence; +pub use ::dafny_runtime::int; +pub use ::dafny_runtime::itertools::Itertools; +pub use ::dafny_runtime::rd; +pub use ::dafny_runtime::string_utf16_of; +pub use ::dafny_runtime::truncate; +pub use ::std::rc::Rc; diff --git a/tests/target/issue-6333.rs b/tests/target/issue-6333.rs new file mode 100644 index 00000000000..b2f167452c3 --- /dev/null +++ b/tests/target/issue-6333.rs @@ -0,0 +1,24 @@ +// rustfmt-edition: 2021 +// rustfmt-max_width: 125 +pub use crate::r#_StructuredEncryptionUtil_Compile::CanonCryptoItem; +pub use crate::r#_StructuredEncryptionUtil_Compile::MessageID; +pub use crate::r#_Wrappers_Compile::Outcome; +pub use crate::software::amazon::cryptography::dbencryptionsdk::structuredencryption::internaldafny::types::CryptoAction; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::AlgorithmSuiteInfo; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptedDataKey; +pub use crate::software::amazon::cryptography::materialproviders::internaldafny::types::EncryptionMaterials; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::HMacInput; +pub use crate::software::amazon::cryptography::primitives::internaldafny::types::IAwsCryptographicPrimitivesClient; +pub use ::dafny_runtime::_System::nat; +pub use ::dafny_runtime::int; +pub use ::dafny_runtime::itertools::Itertools; +pub use ::dafny_runtime::rd; +pub use ::dafny_runtime::string_utf16_of; +pub use ::dafny_runtime::truncate; +pub use ::dafny_runtime::DafnyCharUTF16; +pub use ::dafny_runtime::DafnyType; +pub use ::dafny_runtime::DafnyTypeEq; +pub use ::dafny_runtime::MapBuilder; +pub use ::dafny_runtime::Object; +pub use ::dafny_runtime::Sequence; +pub use ::std::rc::Rc;