• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / rustworkx / 15950552464

29 Jun 2025 02:20AM UTC coverage: 94.619% (-0.6%) from 95.201%
15950552464

Pull #1472

github

web-flow
Merge 253df1f85 into 8cf854cc4
Pull Request #1472: Fix Clippy Lints for Rust 1.88

39 of 50 new or added lines in 16 files covered. (78.0%)

72 existing lines in 19 files now uncovered.

17760 of 18770 relevant lines covered (94.62%)

1551273.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.89
/rustworkx-core/src/err.rs
1
// Licensed under the Apache License, Version 2.0 (the "License"); you may
2
// not use this file except in compliance with the License. You may obtain
3
// a copy of the License at
4
//
5
//     http://www.apache.org/licenses/LICENSE-2.0
6
//
7
// Unless required by applicable law or agreed to in writing, software
8
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
// License for the specific language governing permissions and limitations
11
// under the License.
12

13
//! This module contains common error types and trait impls.
14

15
use std::error::Error;
16
use std::fmt::{Debug, Display, Formatter};
17

18
#[derive(Debug)]
19
pub enum ContractError {
20
    DAGWouldCycle,
21
}
22

23
impl Display for ContractError {
24
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
10✔
25
        match self {
10✔
26
            ContractError::DAGWouldCycle => fmt_dag_would_cycle(f),
10✔
27
        }
28
    }
10✔
29
}
30

31
impl Error for ContractError {}
32

33
#[derive(Debug)]
34
pub enum ContractSimpleError<E: Error> {
35
    DAGWouldCycle,
36
    MergeError(E),
37
}
38

39
impl<E: Error> Display for ContractSimpleError<E> {
40
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
×
41
        match self {
×
42
            ContractSimpleError::DAGWouldCycle => fmt_dag_would_cycle(f),
×
43
            ContractSimpleError::MergeError(ref e) => fmt_merge_error(f, e),
×
44
        }
45
    }
×
46
}
47

48
impl<E: Error> Error for ContractSimpleError<E> {}
49

50
fn fmt_dag_would_cycle(f: &mut Formatter<'_>) -> std::fmt::Result {
10✔
51
    write!(f, "The operation would introduce a cycle.")
10✔
52
}
10✔
53

54
fn fmt_merge_error<E: Error>(f: &mut Formatter<'_>, inner: &E) -> std::fmt::Result {
×
NEW
55
    write!(f, "The merge callback failed with: {inner:?}")
×
56
}
×
57

58
/// Error returned by Layers function when an index is not part of the graph.
59
#[derive(Debug, PartialEq, Eq)]
60
pub struct LayersError(pub String);
61

62
impl Error for LayersError {}
63

64
impl Display for LayersError {
65
    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
×
66
        write!(f, "{}", self.0)
×
67
    }
×
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc