diff --git a/.github/workflows/block-fixup.yml b/.github/workflows/block-fixup.yml index 8bf5e23..a2b8589 100644 --- a/.github/workflows/block-fixup.yml +++ b/.github/workflows/block-fixup.yml @@ -8,6 +8,6 @@ jobs: name: block fixup commits runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: 13rac1/block-fixup-merge-action@v2.0.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a5e765..4e85ff7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,13 +14,13 @@ jobs: strategy: matrix: rust: - - 1.60.0 + - 1.64.0 - stable - beta # - nightly steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install toolchain uses: actions-rs/toolchain@v1 with: @@ -46,7 +46,7 @@ jobs: continue-on-error: ${{ matrix.checks == 'advisories' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: cargo-deny uses: EmbarkStudios/cargo-deny-action@v1 with: @@ -59,10 +59,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.60.0 + toolchain: 1.64.0 - run: rustup component add rustfmt - name: cargo-fmt uses: actions-rs/cargo@v1 @@ -76,7 +76,7 @@ jobs: needs: check steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: cargo-doc uses: actions-rs/cargo@v1 with: @@ -90,13 +90,13 @@ jobs: strategy: matrix: rust: - - 1.60.0 + - 1.64.0 - stable - beta # - nightly steps: - name: Checkout sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install toolchain uses: actions-rs/toolchain@v1 with: @@ -114,10 +114,10 @@ jobs: name: clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.60.0 + toolchain: 1.64.0 override: true - uses: swatinem/rust-cache@v2 - run: rustup component add clippy diff --git a/src/read.rs b/src/read.rs index 84f2715..57f8a5c 100644 --- a/src/read.rs +++ b/src/read.rs @@ -109,7 +109,7 @@ impl<'doc, T> TomlValueReadTypeExt<'doc> for T where T: TomlValueReadExt<'doc>, { - make_type_getter!(read_string, String, "String", Some(&Value::String(ref obj)) => obj.clone()); + make_type_getter!(read_string, String, "String", Some(Value::String(ref obj)) => obj.clone()); make_type_getter!(read_int, i64, "Integer", Some(&Value::Integer(obj)) => obj); make_type_getter!(read_float, f64, "Float", Some(&Value::Float(obj)) => obj); make_type_getter!(read_bool, bool, "Boolean", Some(&Value::Boolean(obj)) => obj); diff --git a/src/resolver/mut_creating_resolver.rs b/src/resolver/mut_creating_resolver.rs index d1780ec..f502b9f 100644 --- a/src/resolver/mut_creating_resolver.rs +++ b/src/resolver/mut_creating_resolver.rs @@ -383,11 +383,11 @@ mod test { match result { Value::Table(ref tab) => { match tab.get("color") { - Some(&Value::String(ref s)) => assert_eq!("red", s), + Some(Value::String(ref s)) => assert_eq!("red", s), _ => unreachable!(), } match tab.get("shape") { - Some(&Value::String(ref s)) => assert_eq!("round", s), + Some(Value::String(ref s)) => assert_eq!("round", s), _ => unreachable!(), } } diff --git a/src/resolver/mut_resolver.rs b/src/resolver/mut_resolver.rs index a0a4078..cb4ec89 100644 --- a/src/resolver/mut_resolver.rs +++ b/src/resolver/mut_resolver.rs @@ -414,11 +414,11 @@ mod test { match result { Value::Table(ref tab) => { match tab.get("color") { - Some(&Value::String(ref s)) => assert_eq!("red", s), + Some(Value::String(ref s)) => assert_eq!("red", s), _ => unreachable!(), } match tab.get("shape") { - Some(&Value::String(ref s)) => assert_eq!("round", s), + Some(Value::String(ref s)) => assert_eq!("round", s), _ => unreachable!(), } } diff --git a/src/resolver/non_mut_resolver.rs b/src/resolver/non_mut_resolver.rs index a6a7a77..63b2d6d 100644 --- a/src/resolver/non_mut_resolver.rs +++ b/src/resolver/non_mut_resolver.rs @@ -421,11 +421,11 @@ mod test { match result { Value::Table(ref tab) => { match tab.get("color") { - Some(&Value::String(ref s)) => assert_eq!("red", s), + Some(Value::String(ref s)) => assert_eq!("red", s), _ => unreachable!(), } match tab.get("shape") { - Some(&Value::String(ref s)) => assert_eq!("round", s), + Some(Value::String(ref s)) => assert_eq!("round", s), _ => unreachable!(), } } diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 371a8a4..43f6974 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -204,7 +204,7 @@ pub fn tokenize_with_seperator(query: &str, seperator: char) -> Result { /// Remove '[' and ']' from a str fn without_array_brackets(s: &str) -> String { trace!("without_array_brackets({:?})", s); - s.replace('[', "").replace(']', "") + s.replace(['[', ']'], "") } fn build_token_tree(split: &mut Split<'_, char>, last: &mut Token) -> Result<()> { @@ -265,7 +265,7 @@ mod test { #[test] fn test_tokenize_empty_query_to_error() { - let tokens = tokenize_with_seperator(&String::from(""), '.'); + let tokens = tokenize_with_seperator("", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -274,7 +274,7 @@ mod test { #[test] fn test_tokenize_seperator_only() { - let tokens = tokenize_with_seperator(&String::from("."), '.'); + let tokens = tokenize_with_seperator(".", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -283,7 +283,7 @@ mod test { #[test] fn test_tokenize_array_brackets_only() { - let tokens = tokenize_with_seperator(&String::from("[]"), '.'); + let tokens = tokenize_with_seperator("[]", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -292,7 +292,7 @@ mod test { #[test] fn test_tokenize_identifiers_with_array_brackets_only() { - let tokens = tokenize_with_seperator(&String::from("a.b.c.[]"), '.'); + let tokens = tokenize_with_seperator("a.b.c.[]", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -301,7 +301,7 @@ mod test { #[test] fn test_tokenize_identifiers_in_array_brackets() { - let tokens = tokenize_with_seperator(&String::from("[a]"), '.'); + let tokens = tokenize_with_seperator("[a]", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -310,7 +310,7 @@ mod test { #[test] fn test_tokenize_single_token_query() { - let tokens = tokenize_with_seperator(&String::from("example"), '.'); + let tokens = tokenize_with_seperator("example", '.'); assert!(tokens.is_ok()); let tokens = tokens.unwrap(); @@ -328,7 +328,7 @@ mod test { #[test] fn test_tokenize_double_token_query() { - let tokens = tokenize_with_seperator(&String::from("a.b"), '.'); + let tokens = tokenize_with_seperator("a.b", '.'); assert!(tokens.is_ok()); let tokens = tokens.unwrap(); @@ -347,7 +347,7 @@ mod test { #[test] fn test_tokenize_ident_then_array_query() { - let tokens = tokenize_with_seperator(&String::from("a.[0]"), '.'); + let tokens = tokenize_with_seperator("a.[0]", '.'); assert!(tokens.is_ok()); let tokens = tokens.unwrap(); @@ -363,7 +363,7 @@ mod test { #[test] fn test_tokenize_many_idents_then_array_query() { - let tokens = tokenize_with_seperator(&String::from("a.b.c.[1000]"), '.'); + let tokens = tokenize_with_seperator("a.b.c.[1000]", '.'); assert!(tokens.is_ok()); let tokens = tokens.unwrap(); @@ -388,7 +388,7 @@ mod test { #[test] fn test_tokenize_empty_token_after_good_token() { - let tokens = tokenize_with_seperator(&String::from("a..b"), '.'); + let tokens = tokenize_with_seperator("a..b", '.'); assert!(tokens.is_err()); let tokens = tokens.unwrap_err(); @@ -462,7 +462,7 @@ mod test { #[test] fn test_pop_last_token_from_identifier_chain() { - let tokens = tokenize_with_seperator(&String::from("a.b.c.d.e.f"), '.'); + let tokens = tokenize_with_seperator("a.b.c.d.e.f", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap(); @@ -473,7 +473,7 @@ mod test { #[test] fn test_pop_last_token_from_mixed_chain() { - let tokens = tokenize_with_seperator(&String::from("a.[100].c.[3].e.f"), '.'); + let tokens = tokenize_with_seperator("a.[100].c.[3].e.f", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap(); @@ -484,7 +484,7 @@ mod test { #[test] fn test_pop_last_token_from_identifier_chain_is_array() { - let tokens = tokenize_with_seperator(&String::from("a.b.c.d.e.f.[1000]"), '.'); + let tokens = tokenize_with_seperator("a.b.c.d.e.f.[1000]", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap(); @@ -495,7 +495,7 @@ mod test { #[test] fn test_pop_last_token_from_mixed_chain_is_array() { - let tokens = tokenize_with_seperator(&String::from("a.[100].c.[3].e.f.[1000]"), '.'); + let tokens = tokenize_with_seperator("a.[100].c.[3].e.f.[1000]", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap(); @@ -506,7 +506,7 @@ mod test { #[test] fn test_pop_last_token_from_one_token() { - let tokens = tokenize_with_seperator(&String::from("a"), '.'); + let tokens = tokenize_with_seperator("a", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap(); @@ -516,7 +516,7 @@ mod test { #[test] fn test_pop_last_chain() { - let tokens = tokenize_with_seperator(&String::from("a.[100].c.[3].e.f.[1000]"), '.'); + let tokens = tokenize_with_seperator("a.[100].c.[3].e.f.[1000]", '.'); assert!(tokens.is_ok()); let mut tokens = tokens.unwrap();