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

Qiskit / rustworkx / 18639575611

20 Oct 2025 01:45AM UTC coverage: 94.186% (-0.01%) from 94.197%
18639575611

Pull #1510

github

web-flow
Merge 2a886a9aa into feda690dc
Pull Request #1510: Bump MSRV to Rust 1.85, Edition to 2024, and PyO3 to 0.26

440 of 460 new or added lines in 41 files covered. (95.65%)

2 existing lines in 1 file now uncovered.

18272 of 19400 relevant lines covered (94.19%)

967619.47 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),
×
NEW
43
            ContractSimpleError::MergeError(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 {
×
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